結果
問題 | No.1049 Zero (Exhaust) |
ユーザー |
|
提出日時 | 2024-12-16 12:55:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 3,356 ms |
コンパイル使用メモリ | 246,612 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-16 12:55:22 |
合計ジャッジ時間 | 4,995 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#ifndef LOCAL #include <bits/stdc++.h> using namespace std; #define debug(...) (void(0)) #else #include "algo/debug.h" #endif #include <atcoder/modint> using mint = atcoder::modint1000000007; void solve() { int P, K; cin >> P >> K; mint ans = 1; mint oth = 0; for (int i = 0; i < K; i++) { mint na = 0, no = 0; na += oth * (P - 1) + ans; no += ans + (oth) * (P - 1); na += P * ans + oth * (P - 1); no += oth * (P - 1); ans = na; oth = no; } cout << ans.val() << endl; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int tt = 1; // std::cin >> tt; while (tt--) { solve(); } }