結果

問題 No.287 場合の数
ユーザー fine
提出日時 2016-04-02 00:39:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 1,304 ms
コンパイル使用メモリ 158,292 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 00:12:47
合計ジャッジ時間 2,071 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    unsigned long long dp[9][601] = {};
    fill(dp[0],dp[0] + 6 * n + 1,1);
    for(int i = 1; i < 9; i++) {
        for(int j = 0; j <= n; j++) {
            dp[i][j] = dp[i - 1][j];
        }
        for(int j = n + 1; j <= 6 * n; j++) {
            dp[i][j] = dp[i - 1][j] - dp[i - 1][j - n - 1];
        }
        if (i != 8) for(int j = 1; j <= 6 * n; j++) dp[i][j] += dp[i][j - 1];
    }
    cout << dp[8][6 * n] << "\n";
    return 0;
}
0