結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
_agatan
|
| 提出日時 | 2015-04-24 18:59:50 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 414 bytes |
| コンパイル時間 | 695 ms |
| コンパイル使用メモリ | 99,108 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 02:33:38 |
| 合計ジャッジ時間 | 1,938 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 21 WA * 9 |
ソースコード
import std.stdio, std.algorithm, std.array, std.conv, std.string;
void main()
{
auto nm = readln().split().map!(to!long);
auto c = readln().split.map!(to!long);
long cnt = 0;
long m = nm[1];
foreach(ci; c) {
if (m - ci < 0) {
break;
} else if (m - ci == 0) {
cnt++;
break;
}
cnt++;
m -= ci;
}
writeln(cnt);
}
_agatan