結果

問題 No.287 場合の数
ユーザー るこーそーるこーそー
提出日時 2024-08-24 00:13:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,180 bytes
コンパイル時間 5,017 ms
コンパイル使用メモリ 310,732 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-08-24 00:14:02
合計ジャッジ時間 6,175 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvvi vector<vvi>
#define vvvl vector<vvl>

template <class T>
auto debug(const T &vec){
    if constexpr (!std::is_arithmetic_v<typename T::value_type>){
        for (const auto &v : vec)debug<typename T::value_type>(v);
        cout << endl;}
    else{
        for (const auto &e : vec){
            cout << e << " ";}
        cout << endl;}
}

void print(){cout << '\n';}
template <class T, class... Ts>
void print(const T &a, const Ts &...b){
    cout << a;
    (cout << ... << (cout << ' ', b));
    cout << '\n';}

int main() {
    int n;
    cin >> n;

    vvl dp(9,vl(6*n+1,0));
    dp[0][0]=1;
    rep(i,8){
        rep(j,6*n+1){
            rep(k,n+1){
                if (j-k>=0)dp[i+1][j]+=dp[i][j-k];
            }
        }
    }

    print(dp[8][6*n]);
}
0