結果

問題 No.156 キャンディー・ボックス
ユーザー Hachimori
提出日時 2015-03-03 23:26:21
言語 Python2
(2.7.18)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-07-05 08:42:36
合計ジャッジ時間 1,380 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8

def read():
    N, M = map(int, raw_input().split())
    cList = map(int, raw_input().split())
    return M, cList


def work((M, cList)):
    ans = 0
    
    for C in sorted(cList):
        if C <= M:
            M -= C
            ans += 1
        else:
            break

    print ans


if __name__ == "__main__":
    work(read())
0