-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastsever.py
35 lines (35 loc) · 1.13 KB
/
fastsever.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
"""Fast server"""
def main():
"""Print ค่าความเร็วของ Server A หรือ B"""
fast_a = int(input())
time_a = str(input())
fast_b = int(input())
time_b = str(input())
# A
if time_a == "Millisecond":
sec_a = fast_a / (10 ** 3)
elif time_a == "Microsecond":
sec_a = fast_a / (10 ** 6)
elif time_a == "Nanosecond":
sec_a = fast_a / (10 ** 9)
elif time_a == "Picosecond":
sec_a = fast_a / (10 ** 12)
# B
if time_b == "Millisecond":
sec_b = fast_b / (10 ** 3)
elif time_b == "Microsecond":
sec_b = fast_b / (10 ** 6)
elif time_b == "Nanosecond":
sec_b = fast_b / (10 ** 9)
elif time_b == "Picosecond":
sec_b = fast_b / (10 ** 12)
# output
if sec_a > sec_b:
print("Server B, %.6f second" %sec_b)
print("Faster than server A , %d times" %(sec_a // sec_b))
elif sec_a < sec_b:
print("Server A, %.6f second" %sec_a)
print("Faster than server B , %d times" %(sec_b // sec_a))
elif sec_a == sec_b:
print("equal")
main()