Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ch = [int(x) for x in open('17.txt')]
- def check(x, y, z):
- if x <= 0 or y <= 0 or z <= 0:
- return 0
- list_of_sides = [x, y, z]
- list_of_sides.sort()
- if (int(list_of_sides[2])) ** 2 < (int(list_of_sides[1])) ** 2 + (int(list_of_sides[0])) ** 2:
- return 1
- else:
- return 0
- count = max_sum = 0
- for i in range(2, len(ch)):
- if check(ch[i], ch[i-1], ch[i-2]):
- count += 1
- max_sum = max(max_sum, ch[i] + ch[i-1] + ch[i-2])
- print(count, max_sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement