結果

問題 No.5 数字のブロック
ユーザー mtk
提出日時 2018-12-12 21:08:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 197 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-09-25 03:41:37
合計ジャッジ時間 2,405 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

l=int(input())
n=int(input())
w=list(map(int,input().split()))

heapq.heapify(w)

sum=count=0
while sum <= l:
    sum += heapq.heappop(w)
    count += 1
count -= 1
print('%d' % count)
0