http://acm.hdu.edu.cn/showproblem.php?pid=1877
#include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<long int>s; //定义栈
long int m,a,b,n;
while(cin>>m)
{ if(m==0) break;
cin>>a>>b;
n=a+b;
if(n==0) cout<<"0"; //特殊情况
while(n)
{
s.push(n%m); //进栈;
n=n/m;
}
while(!s.empty())//栈非空
{
cout<<s.top();//出栈
s.pop(); // 删除栈顶,方便下次出栈
}
cout<<endl;
}
return 0;
}