Problem : 1013 ( Digital Roots )】的更多相关文章

tips:分析不够仔细,白费了许多功夫.输入数据的范围,平时几乎很少考虑的,这个以后得注意.代码检查不够仔细啊,以后得注意了 #include<iostream> using namespace std; void main() { int n=0,sum=0; char s[1000]; while(cin>>s) { n=0; sum=0; if(strcmp(s,"0")==0) break; int len=strlen(s); for(int i=0;…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 90108    Accepted Submission(s): 28027 Problem Description The digital root of a…
Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 79339    Accepted Submission(s): 24800 Problem Description The digital root of a positive integer is found by summing the digits of…
Digital Roots Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits,…
Digital Roots Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits,…
Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 79180    Accepted Submission(s): 24760 Problem Description The digital root of a positive integer is found by summing the digits of…
Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1013 反思:思路很简单,但是注意各位数加起来等于10的情况以及输入0的时候结束程序该怎么去表达 #include<stdio.h> #include<string.h> char a[1000000]; int main() { int i; int sum=0; while(gets(a)&&a[0]!='0') { sum=0; for(i=0;a[i]!='\0'…
#include <stdio.h> int main(void) { int m,i;char n[10000]; while(scanf("%s",&n)==1&&n[0]!='0') { for(m=i=0;n[i];i++) { m+=n[i]-'0'; } printf("%d\n",m%9==0?9:m%9); } return 0; }…
2017-09-07 22:02:01 writer:pprp 简单的水题,但是需要对最初的部分进行处理,防止溢出 /* @theme: hdu 1013 Digital roots @writer:pprp @begin:21:52 @end:21:59 @error:虽然是水题,但是还是需要对最初的处理,如果过大超过了int范围,就出错了 @date:2017/9/7 */ #include <bits/stdc++.h> using namespace std; int main() {…