Ankit_132

B

Nov 4th, 2023
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7.  
  8. int main()
  9. {
  10.     ll int b;
  11.     cin>>b;
  12.  
  13.     for(ll int a=1; a<=15; a++)
  14.     {
  15.         ll int x = 1;
  16.  
  17.         for(int j=1; j<=a; j++)
  18.             x *= a;
  19.  
  20.         if(x == b)
  21.         {
  22.             cout<<a<<"\n";
  23.             exit(0);
  24.         }
  25.     }
  26.  
  27.     cout<<-1<<"\n";
  28.  
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment