-
Notifications
You must be signed in to change notification settings - Fork 0
/
2863.cpp
47 lines (39 loc) · 867 Bytes
/
2863.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
#include<cstdio>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
vector<pair<double, int>> v;
pair <double, int> p;
double arr[2][2];
double Max;
int idx;
int main() {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
scanf("%lf", &arr[i][j]);
}
}
p.first = (arr[0][0] / arr[1][0]) + (arr[0][1] / arr[1][1]);
p.second = 0;
v.push_back(p);
p.first = (arr[1][0] / arr[1][1]) + (arr[0][0] / arr[0][1]);
p.second = 1;
v.push_back(p);
p.first = (arr[1][1] / arr[0][1]) + (arr[1][0] / arr[0][0]);
p.second = 2;
v.push_back(p);
p.first = (arr[0][1] / arr[0][0]) + (arr[1][1] / arr[1][0]);
p.second = 3;
v.push_back(p);
Max = v[0].first;
idx = v[0].second;
for (int i = 1; i < v.size(); i++) {
if (Max < v[i].first) {
Max = v[i].first;
idx = v[i].second;
}
}
printf("%d\n", idx);
return 0;
}