結果
| 問題 | No.1049 Zero (Exhaust) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-25 12:07:14 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 422 bytes |
| 記録 | |
| コンパイル時間 | 3,060 ms |
| コンパイル使用メモリ | 275,008 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2026-06-30 02:04:10 |
| 合計ジャッジ時間 | 4,313 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#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;
}