Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
94063 | 孙嘉言 | 十进制转R进制 | C++ | Accepted | 1 MS | 276 KB | 392 | 2024-10-19 17:53:15 |
#include <iostream> #include <cstring> #include <cmath> using namespace std; int main(){ char b[20]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int x,r; int a[1001],i=0; cin>>x>>r; if(x==0) cout<<0; while(x!=0){ a[i]=x%r; x/=r; i++; }for(int k=i-1;k>=0;k--){ cout<<b[a[k]]; } return 0; }