結果

問題 No.156 キャンディー・ボックス
ユーザー cologne
提出日時 2022-08-29 18:39:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 53,604 KB
最終ジャッジ日時 2024-11-06 16:06:04
合計ジャッジ時間 2,939 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M = map(int, input().split())
    *C, = sorted(map(int, input().split()))
    for i in range(N):
        if sum(C[:i+1]) > M:
            print(i)
            return
    print(N)


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