Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99012 王泰兮 K进制数转L进制数 C++ 解答错误 60 0 MS 256 KB 423 2023-08-21 16:16:47

Tests(3/5):


#include <iostream> #include <cstring> using namespace std; char cha[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int main(){ int k,n,l; while (cin >> k >> n >> l){ int a=1,t1=0; while (n>0){ t1+=n%10*a; n/=10,a*=k; } string ans = ""; while (t1!=0){ ans+=cha[t1%l]; t1/=l; } for (int i = ans.size()-1;i>=0;i--) cout << ans[i]; cout << endl; } }


测评信息: