-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path25285.cpp
48 lines (47 loc) · 827 Bytes
/
25285.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
#include <iostream>
#include <cmath>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
int t;
float cm, kg, bmi;
cin >> t;
for (int i = 0; i < t; i++) {
cin >> cm >> kg;
bmi = 0;
if (cm < 140.1) {
cout << 6 << endl;
}
else if (cm < 146) {
cout << 5 << endl;
}
else if (cm < 159) {
cout << 4 << endl;
}
else if (cm < 161) {
bmi = kg / pow(cm / 100, 2);
if (bmi >= 16 && bmi < 35) {
cout << 3 << endl;
}
else
cout << 4 << endl;
}
else if (cm < 204) {
bmi = kg / pow(cm / 100, 2);
if (bmi >= 20 && bmi < 25) {
cout << 1 << endl;
}
else if (bmi >= 18.5 && bmi < 30) {
cout << 2 << endl;
}
else if (bmi >= 16 && bmi < 35) {
cout << 3 << endl;
}
else {
cout << 4 << endl;
}
}
else
cout << 4 << endl;
}
}