Run ID:163347

提交时间:2026-10-25 10:21:45

#include<bits/stdc++.h> using namespace std; char v(int x){ if(x>=0&&x<=9)return x+'0'; 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 l=x%r; s[i]=v(l); x/=r; i++; } s[i]='\0'; for(int w=i-1;w>=0;w--)cout<<s[w]; return 0; }