题目:http://acm.hdu.edu.cn/showproblem.php?pid=1877
代码:
#include<stdio.h> #include<stdlib.h> int main(){ int m,A,B; while(scanf("%d",&m)!=EOF){ if(m==0)break; scanf("%d %d",&A,&B); int res=A+B; int r[50],count=0,i; while(res/m>0){ r[count++]=res%m; res=res/m; } r[count]=res; for(i=count;i>=0;i--){ printf("%d",r[i]); } printf("/n"); } }
posted on 2011-02-26 16:13 江南烟雨hust 阅读(142) 评论(0) 收藏 举报