結果

問題 No.398 ハーフパイプ(2)
ユーザー tancahn2380tancahn2380
提出日時 2019-05-18 20:22:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 410 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 159,936 KB
実行使用メモリ 247,080 KB
最終ジャッジ日時 2023-10-17 07:45:31
合計ジャッジ時間 8,231 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
198,228 KB
testcase_01 AC 410 ms
247,080 KB
testcase_02 AC 368 ms
242,464 KB
testcase_03 AC 372 ms
242,804 KB
testcase_04 AC 371 ms
242,636 KB
testcase_05 AC 405 ms
246,664 KB
testcase_06 AC 230 ms
222,984 KB
testcase_07 AC 299 ms
233,228 KB
testcase_08 AC 407 ms
247,080 KB
testcase_09 AC 402 ms
246,372 KB
testcase_10 AC 402 ms
246,492 KB
testcase_11 AC 402 ms
246,712 KB
testcase_12 AC 395 ms
245,612 KB
testcase_13 AC 394 ms
245,692 KB
testcase_14 AC 391 ms
245,400 KB
testcase_15 AC 401 ms
246,964 KB
testcase_16 AC 394 ms
245,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


double x;
LL ans;
LL dp[6][101][101][601];
int main(){
    cin >> x;
    int sum = (int)(x * 4 + 1e-10);
    LL ans = 0;
    int lim = sum + 200;
    for (int i = 0; i <= 100; i++) {
        dp[0][i][i][i] = 1;
    }
    for (int i = 1; i < 6; i++) {
        for (int j = 0; j <= 100; j++) {
            for (int k = j; k <= 100; k++) {
                for (int l = 0; l <= lim; l++) {
                    if (dp[i - 1][j][k][l] == 0) continue;
                    for (int m = 0; m <= 100 && l + m <= lim; m++) {
                        dp[i][min(j, m)][max(k, m)][l + m] += dp[i - 1][j][k][l];
                    }
                }
            }
        }
    }
    for (int i = 0; i <= 100; i++) {
        for (int j = i; j <= 100; j++) {
            ans += dp[5][i][j][sum + i + j];
        }
    }
    cout << ans << endl;
}
0