Skip to content

Commit 7977b7d

Browse files
committed
new one
1 parent 5be961d commit 7977b7d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

pashmak_and_garden.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
ios::sync_with_stdio(false);
7+
cin.tie(0);
8+
int x1, y1, x2, y2, x3, y3, x4, y4;
9+
cin >> x1 >> y1 >> x2 >> y2;
10+
11+
int disx = x1 - x2;
12+
int disy = y1 - y2;
13+
14+
if (disx != 0 and disy != 0)
15+
{
16+
x3 = x1;
17+
y3 = y2;
18+
x4 = x2;
19+
y4 = y1;
20+
}
21+
else if (disx != 0)
22+
{
23+
x3 = x1;
24+
y3 = y1 + abs(disx);
25+
x4 = x2;
26+
y4 = y2 + abs(disx);
27+
}
28+
else
29+
{
30+
x3 = x1 + abs(disy);
31+
y3 = y1;
32+
x4 = x2 + abs(disy);
33+
y4 = y2;
34+
}
35+
36+
if (disx != 0 and disy != 0 and abs(disx) != abs(disy))
37+
cout << -1 << endl;
38+
else
39+
cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
40+
return 0;
41+
}

0 commit comments

Comments
 (0)