#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#define f first
#define s second
using namespace std;
typedef long long LL;
LL s1, s2;
string sys;
unordered_map<int, int> ns;//标号映射成进制
signed main()
{
cin>>sys>>s1>>s2;
if(!s1&&!s2)//俩数都为0
{
puts("0");
return 0;
}
for(int i=sys.size()-1, j=1;~i;i--, j++)
{
int t=sys[i]-'0';
if(!t||t==1) t=10;
ns[j]=t;
}
vector<int> alls;
int cnt=1, jin=0, op=0;
while(s1!=0||s2!=0)
{
int t=s1%10+s2%10+jin;
s1/=10, s2/=10;
int xx=ns[cnt++];
if(t>=xx) jin=t/xx, op=t%xx;
else jin=0, op=t;
alls.push_back(op);
}
if(jin) alls.push_back(jin);//最左边有进位
for(int i=alls.size()-1;~i;i--) printf("%d", alls[i]);
}
12-26
156
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-24
06-13