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

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>=0&&x%r<=9){ a[s]=x%r+'0'; } else{ a[s]=x%r+'A'-10; } s++; x/=r; } a[s]='\0'; for(int i=s-1;i>=0;i--){ cout<<a[i]; } return 0; }