結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー ktshun
提出日時 2015-05-28 23:24:36
言語 PyPy2
(7.3.20)
結果
RE  
実行時間 -
コード長 245 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 131 ms
コンパイル使用メモリ 77,736 KB
最終ジャッジ日時 2025-12-03 15:19:15
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other AC * 2 RE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding:utf-8 -*-

if __name__ == "__main__":
	n,m = map(int,raw_input().split())
	cands = map(int,raw_input().split())
	cands.sort()
	sum = 0
	ans = 0
	while ans <= n:
		sum += cands[ans]
		if sum > m:
			break
		elf
		ans += 1
	print ans
0