#include<iostream> using namespace std; int main() { int r,a,b,c,t,i,n; int count,count1 ,count2; int h[1000]={0},m[1000]={0},w[1000]={0}; while(cin>>a>>b>>c,a||b||c) { count = 0,count1 = 0,count2 = 0; t=b+c; while(b) { i=b%a; b/=a; m[count1++]=i; } for(int g=0;g<count1;g++) { cout<<m[count1-g-1]; } cout<<" "<<"+"<<" "; while(c) { n=c%a; c/=a; w[count2++]=n; } for(int f=0;f<count2;f++) { cout<<w[count2-f-1]; } cout<<" "<<"="<<" "; while(t) { r=t%a; t/=a; h[count++]=r; } for(int j=0;j<count;j++) { cout<<h[count-j-1]; } cout<<endl; } return 0; }
joj1006
最新推荐文章于 2013-03-22 16:33:28 发布