1. 程式人生 > >hdu 1212_大數取模

hdu 1212_大數取模

#include <stdio.h>
#include<string.h>
#include <stdlib.h>
#define N 50000
char s[N];
int main()
{
    int i,mod,j,m;
   while(scanf("%s %d",s,&m)!=EOF){
       getchar();
       mod=0;
       for(i=0;i<strlen(s);i++)
       mod=(mod*10+s[i]-'0')%m;
       printf("%d\n",mod);
   }
    return 0;
}