关于大数求余数问题 要是把12行的scanf 换成gets就是错的 这是为什么啊
# include <stdio.h>
# include <string.h>
char s[1000005];
int main()
{
int n;
scanf(“%d”, &n);
fflush(stdin);
while (n–)
{
scanf(“%s”, s); //gets(s); 12行
int len = strlen(s);
int i, mod = 0;
for (i=0; i<len; i++)
mod = ( mod * 10 + s[i]-“0” ) % 10003;
printf(“%d\n”, mod);
}
return 0;
}
# include <stdio.h>
# include <string.h>
char s[1000005];
int main()
{
int n;
scanf(“%d”, &n);
fflush(stdin);
while (n–)
{
scanf(“%s”, s); //gets(s); 12行
int len = strlen(s);
int i, mod = 0;
for (i=0; i<len; i++)
mod = ( mod * 10 + s[i]-“0” ) % 10003;
printf(“%d\n”, mod);
}
return 0;
}
解决方案
20
输入和报错的截个图看看
10
http://blog.csdn.net/qwb492859377/article/details/48323443