Advertisement
nq1s788

17 (тройка)

May 12th, 2024
804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=39763
  2. data = open('17.txt').readlines()
  3. cnt = 0 # 5 6 7 8 9 10
  4. mx = 0
  5. for i in range(len(data) - 2):
  6.     a = int(data[i])
  7.     b = int(data[i + 1])
  8.     c = int(data[i + 2])
  9.     if a >= b and a >= c:
  10.         if b ** 2 + c ** 2 > a ** 2:
  11.             cnt += 1
  12.             mx = max(mx, a + b + c)
  13.     elif b >= a and b >= c:
  14.         if c ** 2 + a ** 2 > b ** 2:
  15.             cnt += 1
  16.             mx = max(mx, a + b + c)
  17.     elif c >= a and c >= b:
  18.         if b ** 2 + a ** 2 > c ** 2:
  19.             cnt += 1
  20.             mx = max(mx, a + b + c)
  21. print(cnt, mx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement