Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 14701 Accepted Submission(s):
5618
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define LL long long
int s[100100];
int main()
{
int m,a,b;
LL n;
int k;
while(scanf("%d",&m),m)
{
scanf("%d%d",&a,&b);
n=a+b;
if(n<=0)
{
printf("0\n");
continue;
}
LL x=n;
k=0;
memset(s,0,sizeof(s));
while(x)
{
s[k++]=x%m;
x/=m;
}
for(int i=k-1;i>=0;i--)
printf("%d",s[i]);
printf("\n");
}
return 0;
}
原文:http://www.cnblogs.com/tonghao/p/4975951.html