| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 163348 | 余建成 | 十进制转R进制 | C++ | Accepted | 2 MS | 272 KB | 368 | 2026-10-25 10:22:15 |
#include<iostream> using namespace std; char nc(int x){ if(x>=0&&x<=9){ return x+'0'; } else if(x>9){ return x+'A'-10; } } int main(){ int x,r,i=0; cin>>x>>r; char s[33]={}; if(x==0){ cout<<0; return 0; } while(x){ int t=x%r; s[i++]=nc(t); x/=r; } s[i]='\0'; for(int j=i-1;j>=0;j--){ cout<<s[j]; } return 0; }