結果

問題 No.5 数字のブロック
ユーザー K5h1n0
提出日時 2023-11-30 06:17:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 202 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 60,288 KB
最終ジャッジ日時 2024-09-26 13:49:41
合計ジャッジ時間 3,161 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

l = int(input())
n = int(input())
a = sorted(list(map(int,input().split())))
ans = 0
for i in a:
    if 0 <= l - i:
        l -= i
        ans += 1
    else:
        print(ans)
        exit()
print(ans)
0