結果

問題 No.158 奇妙なお使い
ユーザー koyoprokoyopro
提出日時 2015-10-22 14:51:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,150 bytes
コンパイル時間 1,364 ms
コンパイル使用メモリ 145,224 KB
実行使用メモリ 13,436 KB
最終ジャッジ日時 2023-09-29 17:27:09
合計ジャッジ時間 3,441 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 20 ms
13,268 KB
testcase_04 AC 20 ms
13,172 KB
testcase_05 AC 20 ms
13,124 KB
testcase_06 AC 20 ms
13,212 KB
testcase_07 AC 20 ms
13,392 KB
testcase_08 WA -
testcase_09 AC 19 ms
13,160 KB
testcase_10 AC 19 ms
13,032 KB
testcase_11 AC 20 ms
13,068 KB
testcase_12 AC 19 ms
12,952 KB
testcase_13 AC 20 ms
13,192 KB
testcase_14 AC 20 ms
13,052 KB
testcase_15 AC 20 ms
13,024 KB
testcase_16 WA -
testcase_17 AC 21 ms
13,132 KB
testcase_18 AC 20 ms
13,108 KB
testcase_19 WA -
testcase_20 AC 20 ms
13,192 KB
testcase_21 AC 19 ms
13,276 KB
testcase_22 AC 21 ms
13,152 KB
testcase_23 AC 20 ms
13,128 KB
testcase_24 AC 20 ms
13,068 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 18 ms
11,980 KB
testcase_28 AC 20 ms
12,828 KB
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)
struct D { int i, j, k; D(){}; D(int _i, int _j, int _k):i(_i),j(_j),k(_k){}; };

int N,T;
int dp[21][211][21111];
int A[3], B[3], C[3];
int Db, Dc;
signed main()
{
    REP(i,3) cin >> A[i];
    cin >> Db;
    REP(i,3) cin >> B[i];
    cin >> Dc;
    REP(i,3) cin >> C[i];

    REP(i,11) REP(j,101-i*10) REP(k,10001-i*1000-j*100) {
        int bi = min(i, Db / 1000);
        int bj = min(j, (Db - bi*1000) / 100);
        int bk = Db - bi * 1000 - bj * 100;
        if (k >= bk) {
            int ni = i - bi + B[0];
            int nj = j - bj + B[1];
            int nk = k - bk + B[2];
            dp[i][j][k] = max(dp[i][j][k], dp[ni][nj][nk] + 1);
        }
        int ci = min(i, Dc / 1000);
        int cj = min(j, (Dc - ci*1000) / 100);
        int ck = Dc - ci * 1000 - cj * 100;
        if (k >= ck) {
            int ni = i - ci + C[0];
            int nj = j - cj + C[1];
            int nk = k - ck + C[2];
            dp[i][j][k] = max(dp[i][j][k], dp[ni][nj][nk] + 1);
        }
    }
    cout << dp[A[0]][A[1]][A[2]] << endl;
    return 0;
}
0