Skip to content

Instantly share code, notes, and snippets.

@hsuan1117
Created November 10, 2019 13:39
Show Gist options
  • Save hsuan1117/523b9c92c8ae066e2810522b583d976e to your computer and use it in GitHub Desktop.
Save hsuan1117/523b9c92c8ae066e2810522b583d976e to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
int main(){
string data;
unsigned long long result = 0;
int from , to ;
cin >> from >> to >> data;
if(from != 10){
for(int i=data.length()-1; i>=0;i--){
string temp="";temp+=data[i];
result += stoi(temp) * pow(from ,data.length()-1-i );
}
cout << result << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment