-
Notifications
You must be signed in to change notification settings - Fork 0
/
C.py
76 lines (71 loc) · 1.65 KB
/
C.py
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
68
69
70
71
72
73
74
75
76
from decimal import Decimal, ROUND_HALF_UP
deg, dis = map(int, input().split())
def direction(deg):
if 0 <= deg < 112.5:
return 'N'
elif deg < 337.5:
return 'NNE'
elif deg < 562.5:
return 'NE'
elif deg < 787.5:
return 'ENE'
elif deg < 1012.5:
return 'E'
elif deg < 1237.5:
return 'ESE'
elif deg < 1462.5:
return 'SE'
elif deg < 1687.5:
return 'SSE'
elif deg < 1912.5:
return 'S'
elif deg < 2137.5:
return 'SSW'
elif deg < 2362.5:
return 'SW'
elif deg < 2587.5:
return 'WSW'
elif deg < 2812.5:
return 'W'
elif deg < 3037.5:
return 'WNW'
elif deg < 3262.5:
return 'NW'
elif deg < 3487.5:
return 'NNW'
else:
return 'N'
def wind(dis):
if Decimal('0.0') <= dis <= Decimal('0.2'):
return 0
elif dis <= Decimal('1.5'):
return 1
elif dis <= Decimal('3.3'):
return 2
elif dis <= Decimal('5.4'):
return 3
elif dis <= Decimal('7.9'):
return 4
elif dis <= Decimal('10.7'):
return 5
elif dis <= Decimal('13.8'):
return 6
elif dis <= Decimal('17.1'):
return 7
elif dis <= Decimal('20.7'):
return 8
elif dis <= Decimal('24.4'):
return 9
elif dis <= Decimal('28.4'):
return 10
elif dis <= Decimal('32.6'):
return 11
elif dis >= Decimal('32.7'):
return 12
dis = Decimal(str(dis))/Decimal('60')
dis = Decimal(dis.quantize(Decimal('0.1'), rounding=ROUND_HALF_UP))
dis = wind(dis)
if dis==0:
print('C', dis)
else:
print(direction(deg), dis)