結果
問題 | No.156 キャンディー・ボックス |
ユーザー | ktshun |
提出日時 | 2015-05-28 23:27:37 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 286 bytes |
コンパイル時間 | 515 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-07-05 09:15:46 |
合計ジャッジ時間 | 1,424 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
# -*- 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 elif sum == m: ans += 1 break else: ans += 1 print ans