提交时间:2024-08-20 16:29:09
运行 ID: 169346
#include <iostream> using namespace std; int main() { int b,n,m; cin>>b>>n>>m; int num=0,num1=0,c=1,ans=0; while (n!=0){ num+=n%10*c; c*=b; n/=10; } c=1; while (m!=0){ num1+=m%10*c; c*=b; m/=10; } num+=num1; while (num!=0){ ans*=10; ans+=num%b; num/=b; } cout<<ans<<endl; return 0; }