-
Notifications
You must be signed in to change notification settings - Fork 0
/
P2863.cpp
50 lines (40 loc) · 907 Bytes
/
P2863.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
#include <iostream>
using namespace std;
double cube[2][2] = {};
double temp[2][2] = {};
void rotate() {
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
temp[i][j] = cube[2-j-1][i];
}
}
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
cube[i][j] = temp[i][j];
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
double a; cin >> a;
cube[i][j] = a;
}
}
int cnt = 0, res = 0;
double m = 0;
for (int i = 0; i < 4; ++i) {
double sum = cube[0][0] / cube[1][0] + cube[0][1] / cube[1][1];
if (sum > m) {
m = sum;
res = cnt;
}
rotate();
cnt++;
}
cout << res;
return 0;
}