Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- *
- * UVa 113 - Power of Cryptography
- *
- * Authors: Caio Marcelo
- *
- * Creation: 18/10/2013
- * Last modification:
- *
- ***/
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- typedef long double Long;
- Long calcRoot(Long val, Long exp){
- Long i = 1;
- while(i <= val){
- if(val == pow(i, exp)){
- return i;
- }
- i++;
- }
- return 0;
- }
- int main(void){
- Long val, exp;
- while(cin >> exp){
- cin >> val;
- cout << fixed << setprecision(0) << calcRoot(val, exp) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement