-Code
for _ in range(int(input())):
j, n = map(int, input().split())
box = []
cnt = 0
for _ in range(n):
a, b = map(int, input().split())
box.append(a * b)
box.sort(reverse=True)
for i in box:
j -= i
cnt += 1
if j <= 0:
print(cnt)
break
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 12782번 비트 우정지수 (0) | 2022.05.08 |
---|---|
[백준/파이썬] 1817번 짐 챙기는 숌 (0) | 2022.05.08 |
[백준/파이썬] 16208번 귀찮음 (0) | 2022.05.08 |
[백준/파이썬] 19939번 박 터뜨리기 (0) | 2022.05.08 |
[백준/파이썬] 20922번 겹치는 건 싫어 (0) | 2022.05.07 |