Skip to content

Instantly share code, notes, and snippets.

@hsuan1117
Created November 13, 2019 09:38
Show Gist options
  • Save hsuan1117/e2a39bdb3cf4543bdb534153ebb04de6 to your computer and use it in GitHub Desktop.
Save hsuan1117/e2a39bdb3cf4543bdb534153ebb04de6 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
void A(int x,int y){
if(x>=y){
A(x/y,y);
}
cout<<x%y;
}
int main(){
int a,b;
string c;
while(cin>>a>>b>>c){
int aa=0;
for(int i=0;i<c.size();i++){
aa=aa*a+(c[i]-'0');
}
A(aa,b);
cout<<'\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment