Problem Type : Number Theory
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
unsigned long long i,j,k,len,a,n,m,s;
char ch[10000];
scanf("%llu",&n);
for(i=1; i<=n; i++)
{
scanf("%llu %s",&a,&ch);
// printf("%lld %s\n",a,ch);
len = strlen(ch);
//reverse (ch,ch+len);
m=0;
for(j=0; j<len; j++)
{
s=ch[j]-'0';
m = (m*10 + s)%a;
}
printf("%llu\n",m);
memset(ch,'\0',sizeof(ch));
}
}
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
unsigned long long i,j,k,len,a,n,m,s;
char ch[10000];
scanf("%llu",&n);
for(i=1; i<=n; i++)
{
scanf("%llu %s",&a,&ch);
// printf("%lld %s\n",a,ch);
len = strlen(ch);
//reverse (ch,ch+len);
m=0;
for(j=0; j<len; j++)
{
s=ch[j]-'0';
m = (m*10 + s)%a;
}
printf("%llu\n",m);
memset(ch,'\0',sizeof(ch));
}
}
No comments:
Post a Comment