1009:Tom数
来源:互联网 发布:淘宝网卖家申请 编辑:程序博客网 时间:2024/06/06 13:04
1009:Tom数
Description
正整数的各位数字之和被Tom称为Tom数。求输入数(n<2^32)的Tom数!
Input
每行一个整数(n<2^32)。
Output
每行一个输出,对应该数的各位 数之和。
Sample Input
12345
56123
82
Sample output
15
17
10
#include<iostream>#include<stdio.h>using namespace std;int main(){ int i; int n; int s; while(1==scanf("%d",&n)) {int count=0; int i=0; while(n/10!=0) { s=n%10; n=n/10; i++; count=count+s; } if(n/10==0) count=count+n; cout<<count<<endl; }
阅读全文
0 0
- 1009: Tom数
- 1009:Tom数
- 1118: Tom数
- Tom数 oj58
- 蓝桥杯—Tom数
- 【水】1021: Tom数-----ZZUOJ
- Tom
- Tom
- 1501051515-hpu-1010 Tom数.cpp
- HDU 5226 Tom and matrix 组合数求和+Lucas定理.
- ZOJ 1516--Uncle Tom's Inherited Land【二分图 && 求最大匹配数 && 经典建图】
- 组合数(Lucas定理) + 快速幂 --- HDU 5226 Tom and matrix
- Travelling Tom
- Tom猫
- TOM猫
- Tom-猫
- Tom-Cat
- Tom的UNLOAD程序
- hadoop心得
- 中断和中断处理
- sqlite一些常见问题
- MongoDB干货篇之查询数据
- JAVA 反射机制
- 1009:Tom数
- spring mvc 控制层validator(校验)中文乱码
- C语言练习题——动态数组
- 把本地jar导入maven库
- 分布式程序设计早知道-关于分布式程序设计常见问题分析
- 引用、常指针、常引用、指针常量、引用常量
- itween移动类型
- Oracle 官方学习文档整理——OCP & OCM
- 【Python】Python3 字典