結果

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

ソースコード

diff #

#! /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