Solve shortest temperatures
This commit is contained in:
parent
d939963237
commit
8605fbd547
1 changed files with 11 additions and 0 deletions
11
temperature_shortest.py
Normal file
11
temperature_shortest.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from math import fabs as f
|
||||
N=int(input())
|
||||
if N==0:
|
||||
print(0)
|
||||
exit(0)
|
||||
T=map(int, input().split())
|
||||
b=next(T)
|
||||
for t in T:
|
||||
if f(t)<f(b):b=t
|
||||
if b<0 and f(b)==t:b=t
|
||||
print(b)
|
Loading…
Reference in a new issue