結果

問題 No.5 数字のブロック
ユーザー Koh Yamashita
提出日時 2017-06-07 04:53:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 470 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-11-18 11:12:45
合計ジャッジ時間 2,680 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

def get_max(my_size, my_list):
    sorted_list = sorted(my_list)
    i = 0
    total = 0
    while total <= my_size:
        if i >= len(my_list):
            return i
        else:
            total += sorted_list[i]
            i += 1
    return i-1


def main():
    box_size = int(input().strip())
    box_num = int(input().strip())
    box_list = list(map(int, input().strip().split()))
    print(get_max(box_size, box_list))

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