結果

問題 No.5 数字のブロック
ユーザー ryusuke
提出日時 2021-02-18 00:03:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 167 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 82,412 KB
実行使用メモリ 60,812 KB
最終ジャッジ日時 2024-09-14 08:38:07
合計ジャッジ時間 2,784 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

l = int(input())
n = int(input())
w = sorted(list(map(int,input().split())))
ans = 0
for i in range(n):
    ans += w[i]
    if ans > l:
        exit(print(i))
print(n)
0