結果

問題 No.1049 Zero (Exhaust)
ユーザー 夜
提出日時 2021-02-26 20:05:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 993 ms
コンパイル使用メモリ 93,624 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 10:36:29
合計ジャッジ時間 2,425 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 31 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 25 ms
6,940 KB
testcase_06 AC 45 ms
6,940 KB
testcase_07 AC 7 ms
6,944 KB
testcase_08 AC 14 ms
6,940 KB
testcase_09 AC 34 ms
6,940 KB
testcase_10 AC 37 ms
6,940 KB
testcase_11 AC 37 ms
6,944 KB
testcase_12 AC 42 ms
6,940 KB
testcase_13 AC 11 ms
6,944 KB
testcase_14 AC 20 ms
6,940 KB
testcase_15 AC 32 ms
6,944 KB
testcase_16 AC 26 ms
6,944 KB
testcase_17 AC 27 ms
6,940 KB
testcase_18 AC 37 ms
6,944 KB
testcase_19 AC 32 ms
6,944 KB
testcase_20 AC 14 ms
6,944 KB
testcase_21 AC 33 ms
6,944 KB
testcase_22 AC 19 ms
6,944 KB
testcase_23 AC 44 ms
6,940 KB
testcase_24 AC 45 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
long long mod = 1000000007;
using namespace std;
int main() {
	long long p, k;
	cin >> p >> k;
	long long z = 1, o = 0;
	for (int i = 0; i < k; i++) {
		long long z1 = (z * (p + 1) % mod + o * 2 * (p - 1) % mod) % mod;
		long long o1 = (z + o * 2 * (p - 1) % mod) % mod;
		z = z1, o = o1;
	}
	cout << z << endl;
}
0