标签:
1 #include<cstdio> 2 #include<cstring> 3 4 int main() 5 { 6 int a[1005]; 7 char s[1005]; 8 int m,i,j; 9 while(scanf("%s%d",s,&m)!=EOF) 10 { 11 int len=strlen(s); 12 for(j=0,i=len-1;i>=0;i--) 13 a[j++]=s[i]-‘0‘; 14 int sum=0; 15 for(j-=1;j>=0;j--) 16 sum=(sum*10+a[j])%m; 17 printf("%d\n",sum); 18 } 19 return 0; 20 }
标签:
原文地址:http://www.cnblogs.com/homura/p/4674204.html