-
Notifications
You must be signed in to change notification settings - Fork 0
/
egypt.cpp
25 lines (23 loc) · 858 Bytes
/
egypt.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x[1000], y[1000], z[1000], times=0;
do
{
cin >> x[times] >> y[times] >> z[times];
times++;
} while (x[times -1] != 0 && y[times-1] != 0 && z[times -1] != 0);
for (int i = 0; i < times-1; i++)
{
int a = x[i], b = y[i], c = z[i];
if (((pow(a,2) + pow(b,2)) == pow(c,2) || (pow(b,2) + pow(c,2)) == pow(a,2) || (pow(a,2) + pow(c,2)) == pow(b,2)) && (a != 0 && b != 0 && c != 0))
cout << "right" << endl;
else if (a == 0 && b == 0 && c == 0)
break;
else if ((pow(a,2) + pow(b,2)) != pow(c,2) || (pow(b,2) + pow(c,2)) != pow(a,2) || (pow(a,2) + pow(c,2)) != pow(b,2))
cout << "wrong" << endl;
}
return 0;
}