提交时间:2023-03-26 12:15:25

运行 ID: 13001

//601161 - 转进制 #include <bits/stdc++.h> using namespace std; int js1(int n,int v){ if(n<v) return n; else return n%v+10*(js1(n/v,v)); } int js(int n,int v){ if(n<v) return n; else{ cout<<(n%v)<<" "; int u=js1(n/v,v); if(u==10){ cout<<"A"; } if(u==11){ cout<<"B"; } if(u==12){ cout<<"C"; } if(u==13){ cout<<"D"; } if(u==14){ cout<<"E"; } if(u==15){ cout<<"F"; } if(u<10){ cout<<u; } } } int main(){ int n,v; cin>>n>>v; cout<<js(n,v); return 0; }