洛谷 P1143 进制转换
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; string x; cin>>n>>x>>m; string ant = to_string(stoi(x,0,n)); long i = 0,j = stoi(ant),a[499999]; while(j>0){ a[i] = j%m; j /= m; i++; } while(i){ cout<<a[--i]; } return 0; }

浙公网安备 33010602011771号