forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeasurement.cpp
67 lines (59 loc) · 1.23 KB
/
measurement.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
58
59
60
61
62
63
64
65
66
67
#include <iostream>
using namespace std;
int main() {
long double d;
cin >> d;
string a, garbo, b;
cin >> a >> garbo >> b;
if(a == "th" || a == "thou")
goto end1;
d *= 1000;
if(a == "in" || a == "inch")
goto end1;
d *= 12;
if(a == "ft" || a == "foot")
goto end1;
d *= 3;
if(a == "yd" || a == "yard")
goto end1;
d *= 22;
if(a == "ch" || a == "chain")
goto end1;
d *= 10;
if(a == "fur" || a == "furlong")
goto end1;
d *= 8;
if(a == "mi" || a == "mile")
goto end1;
d *= 3;
if(a == "lea" || a == "league")
goto end1;
end1:
if(b == "th" || b == "thou")
goto end2;
d /= 1000;
if(b == "in" || b == "inch")
goto end2;
d /= 12;
if(b == "ft" || b == "foot")
goto end2;
d /= 3;
if(b == "yd" || b == "yard")
goto end2;
d /= 22;
if(b == "ch" || b == "chain")
goto end2;
d /= 10;
if(b == "fur" || b == "furlong")
goto end2;
d /= 8;
if(b == "mi" || b == "mile")
goto end2;
d /= 3;
if(b == "lea" || b == "league")
goto end2;
end2:
cout << fixed;
cout.precision(13);
cout << d << endl;
}