結果

問題 No.156 キャンディー・ボックス
ユーザー _agatan_agatan
提出日時 2015-04-24 18:59:50
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 84,988 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-09-02 20:10:47
合計ジャッジ時間 1,913 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 1 ms
4,368 KB
testcase_08 AC 1 ms
4,368 KB
testcase_09 AC 1 ms
4,368 KB
testcase_10 AC 1 ms
4,368 KB
testcase_11 AC 2 ms
4,368 KB
testcase_12 AC 1 ms
4,368 KB
testcase_13 AC 2 ms
4,372 KB
testcase_14 AC 1 ms
4,372 KB
testcase_15 AC 1 ms
4,368 KB
testcase_16 AC 2 ms
4,372 KB
testcase_17 AC 1 ms
4,368 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,368 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,372 KB
testcase_24 AC 2 ms
4,372 KB
testcase_25 AC 1 ms
4,368 KB
testcase_26 AC 2 ms
4,368 KB
testcase_27 AC 2 ms
4,372 KB
testcase_28 WA -
testcase_29 AC 1 ms
4,372 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 2 ms
4,368 KB
testcase_33 AC 2 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
}
0