提交时间:2024-04-06 08:49:17

运行 ID: 141606

#include<bits/stdc++.h> using namespace std; char a[1000005]; int tot = 0; int main(){ int n,d; cin>>n>>d; a[0] = '0'; string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; while(n){ a[++tot] = s[n%d]; n/=d; } int i = tot; do{ cout<<a[i]; i--; }while(i>=1); cout<<'\n'; return 0; }