scripts/ege/Вариант 2023 № 1/17.py

14 lines
385 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
with open("17.txt") as f:
data = list(map(int, f.read().splitlines()))
n = min([x for x in data if str(x)[-2:] == "68"]) ** 2
res = []
for i in range(1, len(data)):
num1 = data[i - 1]
num2 = data[i]
s = [str(num1)[-2:], str(num2)[-2:]]
if s.count("68") == 1 and num1**2 + num2**2 >= n:
res.append(num1**2 + num2**2)
print(len(res), max(res))