Run ID:163348
提交时间:2026-10-25 10:22:15
#include<iostream> using namespace std; char nc(int x){ if(x>=0&&x<=9){ return x+'0'; } else 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 t=x%r; s[i++]=nc(t); x/=r; } s[i]='\0'; for(int j=i-1;j>=0;j--){ cout<<s[j]; } return 0; }