-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2936.cpp
57 lines (55 loc) · 917 Bytes
/
2936.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// 250 * 250 = 62500 / 2 = 31250
double x, y;
cin >> x >> y;
double ansx, ansy;
if (x == 0 && y == 0) {
ansx = 125;
ansy = 125;
}
else if (x == 0) {
if (y <= 125) {
// (250-y) * ansx = 31250
ansx = 31250 / (250 - y);
ansy = 250 - ansx;
}
else {
ansx = 31250 / y;
ansy = 0;
// y * ansx = 31250
}
}
else if (y == 0) {
if (x <= 125) {
ansy = 31250 / (250 - x);
ansx = 250 - ansy;
}
else {
ansy = 31250 / x;
ansx = 0;
}
}
else {
if (x == 125 && y == 125) {
ansx = 0;
ansy = 0;
}
else if (x < 125) {
//y * (250-ansx) = 31250
ansx = 250 - (31250 / y);
ansy = 0;
}
else {
ansy = 250 - (31250 / x);
ansx = 0;
}
}
cout << fixed << setprecision(2) << ansx << " " << ansy;
}