DialOG_

Untitled

Feb 21st, 2021
390
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with open('27_1 — копия (3).txt','r')as f:
  2.     lines = f.read().split('\n')
  3.  
  4.  
  5.  
  6. n = int(lines[0])
  7. a = lines[1:]
  8.  
  9. c = 0
  10. p1 = 0
  11. p2 = 0
  12. for i in range(0,n-1):
  13.     for j in range(i+1,n):
  14.         if int(a[i])>int(a[j]) and i < j and (int(a[i])+int(a[j])) > c and (int(a[i])+int(a[j])) % 117 == 0:
  15.             c = int(a[i])+int(a[j])
  16.             p1 = a[i]
  17.             p2 = a[j]
  18. if p1 == 0 and p2 == 0:
  19.     print('NO')
  20. else:
  21.     print(p1, p2)
  22.  
RAW Paste Data