結果
問題 |
No.156 キャンディー・ボックス
|
ユーザー |
![]() |
提出日時 | 2016-02-22 15:35:25 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 107,936 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 02:59:17 |
合計ジャッジ時間 | 1,642 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto input = readln.split.to!(int[]); auto N = input[0], M = input[1]; auto C = readln.split.to!(int[]); C.sort; foreach (ref e; C) { if (M == 0) break; auto tmp = min(e, M); e -= tmp; M -= tmp; } C.count!"a==0".writeln; }