原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=105

分析:各位数求和再模9.

九的余数

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

 

相关文章:

  • 2021-06-20
  • 2021-06-11
  • 2021-06-11
  • 2021-11-24
  • 2022-01-14
  • 2021-09-18
  • 2021-06-26
  • 2021-06-17
猜你喜欢
  • 2021-11-24
  • 2022-02-27
  • 2021-06-05
  • 2021-12-06
  • 2022-12-23
  • 2021-06-01
  • 2021-05-08
相关资源
相似解决方案