結果

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

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)

def main():
    l = int(input())
    n = int(input())
    ww = list(map(int, input().split()))
    ww.sort()
    s = 0
    cnt = 0
    for w in ww:
        s += w
        cnt += 1
        if s > l: break
    else:
        cnt += 1
    print(cnt - 1)

main()
0