Run ID:48626
提交时间:2023-06-10 15:43:16
//include<bits/stdc++.h>erase #include<iostream> #include<string> int a[330]; using namespace std; int main(){ //freopen(a.in,"r",stdin); //freopen(b.out,"w",stdout); int n,r; cin >> n >> r; if(n == 0) { cout << "0"; } else{ int c = 0,t = n;; while(t != 0){ a[c] = t % r; t /= r; c++; } for(int i = c - 1;i >=0;i--){ if(a[i] == 10){ cout << 'A'; } else if(a[i] == 11){ cout << 'B'; } else if(a[i] == 12){ cout << 'C'; } else if(a[i] == 13){ cout << 'D'; } else if(a[i] == 14){ cout << 'E'; } else if(a[i] == 15){ cout << 'F'; } else cout << a[i]; } } return 0; }