Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155263 任艺宸 十进制转R进制 C++ Accepted 1 MS 272 KB 601 2026-06-06 12:19:22

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int x,r,y,i=0; char s[101]={}; cin>>x>>r; if(x==0){ cout<<0<<endl; return 0; } while(x!=0){ y=x%r; if(y>=0&&y<=9){ s[i++]=char(y+'0'); }else{ s[i++]=char(y+'A'-10); } x/=r; }for(int j=i-1;j>=0;j--)cout<<s[j]; return 0; }