Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
166388 | B班---刘鸿晖 | 进制数加法 | C++ | 解答错误 | 50 | 0 MS | 236 KB | 454 | 2024-08-19 14:07:14 |
#include<bits/stdc++.h> using namespace std; long long a[105],m; long long mtoten(long long n){ long long sum=0,cnt=1; while(n>0){ long long s=n%10; n/=10; sum+=s*cnt; cnt*=m; } return sum; } void tentom(long long n){ long long cnt=0; while(n>0){ cnt++; a[cnt]=n%m; n/=m; } for(int i=cnt;i>=1;i--){ cout<<a[i]; } } int main(){ long long x,y; cin>>m>>x>>y; tentom(mtoten(x)+mtoten(y)); return 0; }