Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f, count, max_sum = [], 0, -(10 ** 10)
- i = int(input())
- f.append(i)
- while i != 0:
- i = int(input())
- f.append(i)
- f.pop(len(f) - 1)
- for i in range(len(f) - 2):
- if i - 1 >= 0 and i + 1 <= len(f) - 1:
- if f[i] % 10 == 9 and f[i] > 0 and (f[i + 1] % 10 != 9 or f[i + 1] <= 0) and (f[i - 1] % 10 != 9 or f[i - 1] <= 0):
- count += 1
- if max_sum < f[i - 1] + f[i] + f[i + 1]:
- max_sum = f[i - 1] + f[i] + f[i + 1]
- print(count, max_sum)
- i = int(input())
- f.append(i)
- count, min_ras = 0, 10 ** 10
- f.append(i)
- while i != 0:
- i = int(input())
- f.append(i)
- f.pop(len(f) - 1)
- for i in range(1, len(f) - 1):
- if f[i - 1] < f[i] and f[i] < f[i + 1] and i + 1 < len(f):
- count += 1
- if (max(f[i - 1], f[i], f[i + 1]) - min(f[i - 1], f[i], f[i + 1])) < min_ras:
- min_ras = max(f[i - 1], f[i], f[i + 1]) - min(f[i - 1], f[i], f[i + 1])
- print(count)
- print(min_ras)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement