标签:style color os 数据 io for re c
现在给你一个自然数n,它的位数小于等于一百万,现在你要做的就是求出这个数整除九之后的余数。
3 4 5 465456541
4 5 4
#include<stdio.h>
#include<string.h>
char str[1000010];
int main()
{
int l,m,s,i;
char n;
scanf("%d",&m);
while(m--)
{
s=0;
scanf("%s",str);
l=strlen(str);
for(i=0;i<l;i++)
s+=(str[i]-'0');
printf("%d\n",s%9);
}
return 0;
}
标签:style color os 数据 io for re c
原文地址:http://blog.csdn.net/qq_16767427/article/details/38084797