-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path407a.cpp
More file actions
42 lines (35 loc) · 692 Bytes
/
407a.cpp
File metadata and controls
42 lines (35 loc) · 692 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int t;
int xa, ya, xb, yb;
bool flag = false;
for (xa = 1; xa < a-1; xa++) {
t = a*a-xa*xa;
ya = round(sqrt(t));
if (t != ya*ya)
continue;
double c = -1.0*xa/ya;
xb = -round(sqrt(1.0*b*b/(1.0+c*c)));
yb = round(c*xb);
if (xb*xb+yb*yb != b*b)
continue;
if (xa == xb || ya == yb)
continue;
flag = true;
break;
}
if (flag) {
cout << "YES" << endl;
cout << 0 << " " << 0 << endl;
cout << xa << " " << ya << endl;
cout << xb << " " << yb << endl;
}
else {
cout << "NO" << endl;
}
return 0;
}