-
-
Save hsuan1117/523b9c92c8ae066e2810522b583d976e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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