結果
問題 | No.1049 Zero (Exhaust) |
ユーザー | わなわな |
提出日時 | 2020-05-08 22:56:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 362 bytes |
コンパイル時間 | 632 ms |
コンパイル使用メモリ | 68,820 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 01:06:46 |
合計ジャッジ時間 | 1,785 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; long long mod = 1e9 + 7; typedef long long ll; int main(){ ll P, K; cin >> P >> K; ll ans0 = P + 1; ll size = 2* P; for(int i = 1; i < K; i++){ ans0 = (ans0 * (P - 1) + 2 * size) % mod; size = (2*size * P) % mod; } cout << ans0 << endl; }