Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #21171
- n = 10000
- f = open('2.txt')
- # print(len(f.readlines()))
- def maxa(x, y):
- if x > y:
- return x
- else:
- return y
- def mina(x, y):
- if y < x:
- return y
- else:
- return x
- a = []
- c = 0
- maxam = -10000000000000
- minmin = 10000000000000
- for i in range(n):
- x = int(f.readline())
- a.append(x)
- print(a)
- # a = [4220, -4180, 1496, -1408, 2268, 3024]
- for i in range(n - 1):
- if (a[i] + a[i + 1] != 0) and ((a[i] * a[i + 1]) % (a[i] + a[i + 1]) == 0):
- c += 1
- maxi = maxa(a[i], a[i + 1])
- mini = mina(a[i], a[i + 1])
- maxam = maxa(maxi, maxam)
- minmin = mina(mini, minmin)
- # print(maxam, minmin, '||', a[i], a[i + 1])
- print(c, maxam + minmin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement