結果

問題 No.287 場合の数
ユーザー nejineji
提出日時 2020-03-08 13:50:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,009 bytes
コンパイル時間 1,650 ms
コンパイル使用メモリ 170,660 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-07 01:40:28
合計ジャッジ時間 2,646 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

int main(){
        ll n;
        cin >> n;
        ll m = 6 * n;
        vll a(6 * n + 1);
        a[0] = 1;
        REP(i,1,8){
                vll b(m+1);

                REP(j,0,m){
                        if(j >= n+1){
                                b[j] = a[j] - a[j-(n+1)];              
                        }else{
                                b[j] = a[j];
                        }
                }
                swap(a,b);
                REP(j,1,m){
                        a[j] += a[j-1];
                }

        }
        cout << a[n * 6] << endl;
}
0