結果

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

ソースコード

diff #
raw source code

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        n, m = map(int, raw_input().split())
        c = map(int, raw_input().split())
        c.sort()
        tmp = m
        ans = 0
        for i in range(len(c)):
            if tmp >= c[i]:
               ans += 1
               tmp -= c[i]
            else:
                break
        print ans
        
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()
0