結果

問題 No.398 ハーフパイプ(2)
ユーザー りあんりあん
提出日時 2016-07-15 01:04:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 1,105 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 165,072 KB
実行使用メモリ 200,416 KB
最終ジャッジ日時 2023-09-09 21:57:36
合計ジャッジ時間 5,302 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
200,296 KB
testcase_01 AC 166 ms
200,156 KB
testcase_02 AC 166 ms
200,156 KB
testcase_03 AC 166 ms
200,248 KB
testcase_04 AC 165 ms
200,320 KB
testcase_05 AC 166 ms
200,132 KB
testcase_06 AC 165 ms
200,348 KB
testcase_07 AC 165 ms
200,292 KB
testcase_08 AC 165 ms
200,304 KB
testcase_09 AC 164 ms
200,408 KB
testcase_10 AC 165 ms
200,416 KB
testcase_11 AC 165 ms
200,308 KB
testcase_12 AC 164 ms
200,252 KB
testcase_13 AC 165 ms
200,408 KB
testcase_14 AC 166 ms
200,296 KB
testcase_15 AC 166 ms
200,132 KB
testcase_16 AC 166 ms
200,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

long long dp[5][101][101][601];
int main() {
    for (int i = 0; i < 101; ++i) {
        dp[0][i][i][i << 1] = 1;
        for (int j = i + 1; j < 101; ++j)
            dp[0][i][j][i + j] = 2;
    }
    for (int i = 1; i < 5; i++) {
        for (int j = 0; j < 101; j++) {
            for (int k = j; k < 101; k++) {
                int l = j * i + k, r = j + k * i;
                for (; l <= r; ++l) {
                    int m = 0;
                    for (; m < j; ++m)
                        dp[i][m][k][l + m] += dp[i - 1][j][k][l];
                    for (; m < k; ++m)
                        dp[i][j][k][l + m] += dp[i - 1][j][k][l];
                    for (; m < 101; ++m)
                        dp[i][j][m][l + m] += dp[i - 1][j][k][l];
                }
            }
        }
    }
    
    double x;
    cin >> x;
    int sum = (int)(x * 4 + 1e-9);
    long long ans = 0;
    
    for (int i = 0; i < 101; ++i)
        for (int j = i; j < 101; ++j)
            ans += dp[4][i][j][sum + i + j];
    
    cout << ans << "\n";
    return 0;
}
0