博客写的比较简单,以后会回来总结修改,菜鸟成长中
#include <iostream>
#include <string>
using namespace std;
int main()
{
int a, b, n;
cin >> a >> b >> n;
int c = a + b;
string s;
if (c == 0){
cout << "0";
}
else{
while (c){
int temp = c % n;
s += to_string(temp);
c = c / n;
}
for (int i = s.length() - 1; i >= 0; i--){
cout << s[i];
}
}
return 0;
}