地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=105

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

 1 #include<stdio.h>
 2 #include<string.h>
 3 char num[1000100];
 4 int main()
 5 {
 6     long int i;
 7     int n,temp,t;
 8     scanf("%d",&n);
 9     while(n--)
10     {
11         scanf("%s",num);
12         t=strlen(num);
13         for(temp=0,i=0;i<t;i++)
14         temp=(temp*10+num[i]-'0')%9;
15         printf("%d\n",temp%9);
16     }
17     return 0;
18 }

相关文章:

  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
猜你喜欢
  • 2021-11-10
  • 2021-12-01
  • 2021-07-12
  • 2021-09-03
  • 2021-08-13
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案