Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. m = int(input())
  2. n = int(input())
  3. a = [int(input()) for i in range(n)]
  4. cnt = 0
  5. while a != []:
  6.     _max = max(a)
  7.     _min = min(a)
  8.     if _max + _min <= m:
  9.         a.remove(_max)
  10.         a.remove(_min)
  11.     else:
  12.         a.remove(_max)
  13.     cnt += 1
  14. print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement