結果

問題 No.5 数字のブロック
ユーザー roaris
提出日時 2021-04-27 03:16:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 186 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 61,852 KB
最終ジャッジ日時 2024-07-05 18:51:17
合計ジャッジ時間 2,536 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

L = int(input())
N = int(input())
W = list(map(int, input().split()))
W.sort()
now = 0
ans = 0

for i in range(N):
    now += W[i]

    if now<=L:
        ans = max(ans, i+1)

print(ans)
0