| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 163345 | 李沐阳 | 十进制转R进制 | C++ | Accepted | 1 MS | 272 KB | 385 | 2026-10-25 10:19:20 |
#include<bits/stdc++.h> using namespace std; char nc(int q){ if(q>=0&&q<=9){ return q+'0'; } else if(q>9){ return q+'A'-10; } } int main(){ int d,r,i=0; cin>>d>>r; char a[33]={}; if(d==0){ cout<<0<<endl; return 0; } while(d){ int s=d%r; a[i]=nc(s); d/=r; i++; } a[i]='\0'; for(int w=i-1;w>=0;w--){ cout<<a[w]; } return 0; }