Advertisement
daniil-vlasenko

7.30

Jul 12th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. n = int(input())
  2. s = int(input())
  3. m1 = s
  4. m2 = s
  5. for i in range(n-1):
  6. s = int(input())
  7. if s < m1 and s > m2:
  8. m1 = s
  9. elif s < m2 and s > m1:
  10. m2 = s
  11. elif s < m2 and s < m1:
  12. if m1 < m2:
  13. m2 = s
  14. else:
  15. m1 = s
  16. if m1 < m2:
  17. print(m1, m2)
  18. else:
  19. print(m2, m1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement