http://acm.hdu.edu.cn/showproblem.php?pid=1877
这道题得到的教训是,long long unsigned 千万不要滥用
注意题意有没有说非负整数
#include<iostream>
#include<stack>
#define ll long long
using namespace std;
int main(){
int a,b,m;
while(cin>>m&&m!=0){
cin>>a>>b;
ll c=a+b;
stack<int>s;
while(c){
s.push(c%m);
c/=m;
}
//特别0的特判
if(s.empty())cout<<0;
while(!s.empty()){
cout<<s.top();s.pop();
}cout<<endl;
}
}