This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
DSA/midterm_prep/202_max_distance.py
2019-03-28 11:45:47 +01:00

26 lines
416 B
Python
Executable file

#!/usr/bin/env python3
import sys
def maximal_distance(A):
if len(A) == 0:
return None
max_n = A[0]
min_n = A[0]
for i in range(1,len(A)):
if max_n < A[i]:
max_n = A[i]
elif min_n > A[i]:
min_n = A[i]
return max_n - min_n
A = []
for line in sys.stdin:
if line[0] == '\n':
break
A.append(int(line))
print(maximal_distance(A))