用户输出
25646167
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#64133 | #110. czq的模法数列 | Accepted | 100 | 38 ms | 488 K | C++ 17 / 565 B | feicheng | 2022-01-27 0:38:53 |
// Author:Feicheng
/* -------- Main part of the Program--------*/
#include "bits/stdc++.h"
using std::cin;
using std::cout;
int n, q, p;
int main(int argc, const char** argv) {
#ifdef Feicheng
freopen("input.in", "r", stdin);
freopen("output.ans", "w", stdout);
#endif
std::basic_ios<char>::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n >> q >> p;
int v = 1, ans = 0;
for (int i = 1; i <= n; ++i) {
ans = (ans + v) % p;
v = 1ll * v * q % p;
}
cout << (ans + p) % p;
return 0;
}
用户输出
192041748
系统信息
Exited with return code 0
用户输出
917164423
系统信息
Exited with return code 0
用户输出
626438667
系统信息
Exited with return code 0