結果

問題 No.5 数字のブロック
ユーザー hiro_metal_core
提出日時 2017-11-03 22:11:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 262 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-11-18 11:49:38
合計ジャッジ時間 2,037 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

L = int(input())
N = int(input())

W = list(map(int, input().split()))
W.sort()
W.reverse()

sum_of_w = 0

for n in range(N):
    sum_of_w += W[n]

while(1):
    if (sum_of_w <= L):
        break
    else:
        sum_of_w -= W[0]
        W.pop(0)

print(len(W))
0