| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 163347 | 张蔚林 | 十进制转R进制 | C++ | Accepted | 1 MS | 272 KB | 345 | 2026-10-25 10:21:45 |
#include<bits/stdc++.h> using namespace std; char v(int x){ if(x>=0&&x<=9)return x+'0'; 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 l=x%r; s[i]=v(l); x/=r; i++; } s[i]='\0'; for(int w=i-1;w>=0;w--)cout<<s[w]; return 0; }