• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Mar 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. struct w
2. {
3.     ll a, b, c;
4. };
5.
6. vector<w> getlen(ll x)
7. {
8.     vector<w> ans;
9.     for (ll y = x; y >= 0; y--) {
10.         ll z = x*x - y*y;
11.         ll q = (ll)sqrt(z*1.);
12.         if (q*q == z)
13.             ans.push_back(w{y, q, x});
14.     }
15.
16.     return ans;
17. }
18.
19. int main()
20. {
21. #ifdef _DEBUG
22.     freopen("input.txt", "rt", stdin);
23.     freopen("output.txt", "wt", stdout);
24. //#else
25. //    freopen(name".in", "rt", stdin);
26. //    freopen(name".out", "wt", stdout);
27. #endif
28.
29.     ll a, b, c;
30.     cin >> a >> b >> c;
31.
32.     auto q1 = getlen(a);
33.     auto q2 = getlen(b);
34.
35.     vector<pii> p = { {1, 1}, {-1, 1}, {1, -1}, {-1, -1} };
36.
37.     for (w tr1 : q1) {
38.         for (w tr2 : q2) {
39.             for (int i = 0; i < 4; i++)
40.                 for (int j = 0; j < 4; j++) {
41.                     ll x1 = tr1.a * p[i].X;
42.                     ll y1 = tr1.b * p[i].Y;
43.
44.                     ll x2 = tr2.a * p[j].X;
45.                     ll y2 = tr2.b * p[j].Y;
46.
47.                     if ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1) == c*c) {
48.                         printf("%lld %lld\n", x1, y1);
49.                         printf("%lld %lld\n", x2, y2);
50.                         printf("0 0");
51.                         return 0;
52.                     }
53.                 }
54.         }
55.     }
56.
57.     printf("-1");
58.
59.     return 0;
60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top