結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー HIROPON87069639
提出日時 2016-02-27 15:43:14
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 229 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 154 ms
コンパイル使用メモリ 76,700 KB
最終ジャッジ日時 2025-12-03 19:33:06
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding: utf-8 -*-
N, M = map(int, raw_input().split())
C = map(int, raw_input().split())
C.sort()
tot = 0
cnt = 0
while tot < M and cnt != N:
    tot += C[cnt]
    cnt += 1
if M == tot:
    print cnt
else:
    print cnt - 1
0