提交时间:2023-08-21 16:20:48
运行 ID: 99023
#include<iostream> using namespace std; int main() { int n,p,q; while(1) { cin>>p>>n>>q; int j=21,a[21],i,s=0; while(n>0) { j=j-1; a[j]=n%10; n/=10; } s=0; for(int i=j;i<=20;++i) s=s*p+a[i]; j=21; while(s>0) { j=j-1; a[j]=s%q; s=s/q; } for(int i=j;i<=20;i++) cout<<a[i]; cout<<"\n"; } return 0; }