結果

問題 No.1049 Zero (Exhaust)
ユーザー karinohitokarinohito
提出日時 2023-03-25 12:07:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 5,315 ms
コンパイル使用メモリ 263,920 KB
実行使用メモリ 11,092 KB
最終ジャッジ日時 2023-10-18 23:21:50
合計ジャッジ時間 5,806 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 14 ms
8,588 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 11 ms
7,532 KB
testcase_06 AC 17 ms
11,092 KB
testcase_07 AC 4 ms
4,364 KB
testcase_08 AC 8 ms
5,684 KB
testcase_09 AC 14 ms
9,048 KB
testcase_10 AC 15 ms
9,580 KB
testcase_11 AC 15 ms
9,840 KB
testcase_12 AC 17 ms
10,632 KB
testcase_13 AC 6 ms
4,892 KB
testcase_14 AC 9 ms
6,740 KB
testcase_15 AC 14 ms
8,852 KB
testcase_16 AC 11 ms
7,796 KB
testcase_17 AC 12 ms
7,796 KB
testcase_18 AC 15 ms
9,840 KB
testcase_19 AC 13 ms
8,784 KB
testcase_20 AC 7 ms
5,684 KB
testcase_21 AC 14 ms
9,048 KB
testcase_22 AC 8 ms
6,476 KB
testcase_23 AC 17 ms
11,092 KB
testcase_24 AC 18 ms
11,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
using mint =modint1000000007;
using vm = vector<mint>;
int main() {
    ll P,K;
    cin>>P>>K;
    vm D(K+1,0),E(K+1,0);
    D[0]=1;
    rep(i,K){
        E[i+1]=(D[i]+2*E[i])*(P-1);
        D[i+1]=2*E[i]+D[i]*(P+1);
    }
    cout<<D[K].val()<<endl;
}

0