Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Timus 1349
- #include <cmath>
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, ch=0;
- cin >> n;
- for(int a=1;a<101;a++)
- {
- for(int b=a+1;b<101;b++)
- {
- for(int c=b+1;c<101;c++)
- {
- if((pow(a, n) + pow(b, n))==(pow(c, n)))
- {
- cout << a << " " << b << " " << c << endl;
- ch=1;
- }
- if(ch==1){break;}
- }
- if(ch==1){break;}
- }
- if(ch==1){break;}
- }
- if(ch==0){cout << "-1";}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement