Run ID:155263

提交时间:2026-06-06 12:19:22

#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; }