http://acm.hdu.edu.cn/showproblem.php?pid=1877

View Code
 1 #include<iostream>
 2 using namespace std;
 3 
 4 void change(int m,int a)
 5 {
 6     int s[20]={0};
 7     int i=0;
 8     while(a)
 9     {
10         s[i++]=a%m;
11         a=a/m;
12     }
13     while(i)
14         cout<<s[--i];
15     cout<<endl;
16 }
17 
18 int main()
19 {
20     int m,a,b;
21     while(cin>>m,m)
22     {
23         cin>>a>>b;
24         a=a+b;
25         if(a==0)
26             cout<<0<<endl;
27         else
28             change(m,a);
29     }
30     return 0;
31 }

 

相关文章:

  • 2021-08-06
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2021-10-27
  • 2021-07-22
相关资源
相似解决方案