Submission
Status:
PPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Phupa
Problemset: บวกเลขฐาน
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-13 14:56:58
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
int base;
cin>>base;
string s1,s2;
cin>>s1>>s2;
int x1,x2;
x1 = stoll(s1,NULL,base);
x2 = stoll(s2,NULL,base);
x1 += x2;
string ans = "";
while (x1 != 0)
{
int r = x1 % base;
if (r >= 10)
{
ans = char(55+r) + ans;
}
else ans = to_string(r) + ans;
x1 /= base;
}
if (ans.length() == 0) cout<<"0"<<"\n";
else cout<<ans<<"\n";
return 0;
}