結果

問題 No.5 数字のブロック
ユーザー yoshiisland_dev
提出日時 2016-11-27 15:46:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 402 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-11-18 10:46:20
合計ジャッジ時間 2,028 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

def main():
    a = int(input())
    b = int(input())
    c = [int(x) for x in input().split()]

    c.sort()
    y = []

    for i in c:
        if sum(y)+i <= a:
            y.append(int(i))
            sum(y)

    else:
        ans = len(y)
        if ans > b:
            print("error")
        else:
            print(ans)

    pass

if __name__ == "__main__":
    main()
0