您的位置:首页 > 其它

NYOJ 105 九的余数

2012-08-19 09:31 239 查看
地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=105

思路:大数求余,同NYOJ 205 求余数

#include<stdio.h>
#include<string.h>
char num[1000100];
int main()
{
long int i;
int n,temp,t;
scanf("%d",&n);
while(n--)
{
scanf("%s",num);
t=strlen(num);
for(temp=0,i=0;i<t;i++)
temp=(temp*10+num[i]-'0')%9;
printf("%d\n",temp%9);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: