結果

問題 No.5 数字のブロック
ユーザー _KingdomOfMoray
提出日時 2019-12-22 21:17:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 274 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-09-14 17:29:35
合計ジャッジ時間 2,365 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

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

sorted_w = sorted(w_list)
ever = 0
count = 0

for i in range(n):
    if ever + sorted_w[i] > l:
        break
    else:
        ever += sorted_w[i]
        count += 1
        
res = count

print(res)
0