結果

問題 No.158 奇妙なお使い
ユーザー nebukuro09nebukuro09
提出日時 2017-03-23 10:48:19
言語 D
(dmd 2.107.1)
結果
TLE  
実行時間 -
コード長 840 bytes
コンパイル時間 1,006 ms
コンパイル使用メモリ 93,580 KB
実行使用メモリ 11,400 KB
最終ジャッジ日時 2023-09-03 12:34:59
合計ジャッジ時間 13,608 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

int[2] cost, A, B, C;
int[] mem;

int dp(int a, int b, int c) {
    int ret = 0;
    foreach (i; 0..2) {
        foreach (j; 0..a+1) {
            foreach (k; 0..b+1) {
                int oneyen = cost[i] - j * 1000 - k * 100;
                if (oneyen < 0 || oneyen > c) continue;
                ret = max(ret, dp(a-j+A[i], b-k+B[i], c-oneyen+C[i]) + 1);
            }
        }
    }
    return ret;
}

void main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    scanf("%d", &cost[0]);
    scanf("%d %d %d", &A[0], &B[0], &C[0]);
    scanf("%d", &cost[1]);
    scanf("%d %d %d", &A[1], &B[1], &C[1]);
    dp(a, b, c).writeln;
}
0