Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138468 冯诚阳 十进制转R进制 C++ Accepted 1 MS 276 KB 398 2025-11-24 18:58:20

Tests(10/10):


Code:

#include <iostream> using namespace std; int main(){ int x,r,s=0; char a[33]; cin>>x>>r; if(x==0){ cout<<0;return 0; } while(x!=0){ if(x%r>9){ a[s]=x%r+'A'-10; } else{ a[s]=x%r+'0'; } s++; x/=r; } for(int i=s-1;i>=0;i--){ cout<<a[i]; } return 0; }