結果

問題 No.5 数字のブロック
ユーザー Hydru
提出日時 2023-01-15 14:46:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 199 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 59,776 KB
最終ジャッジ日時 2024-12-28 07:05:09
合計ジャッジ時間 2,957 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

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

W.sort()
cnt=0
width=0

for i in range(n):
    if width+W[i]<=l:
        cnt+=1
        width+=W[i]
    else:
        break

print(cnt)
0