用户输出
25646167
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#103916 | #110. czq的模法数列 | Accepted | 100 | 36 ms | 560 K | C++ 17 / 626 B | Sakura丶Charon | 2024-05-06 19:56:08 |
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define debug(x) cout << #x " = " << x << '\n';
using namespace std;
void solve() {
int n, q, p;
cin >> n >> q >> p;
int a1 = 1;
int ans = 1;
for (int i = 0; i < n - 1; i++) {
a1 = a1 * q % p;
ans = (ans + a1) % p;
}
cout << ans << '\n';
}
signed main() {
// freopen("Sample.in", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
// cin >> T;
while (T--) solve();
return 0;
}
用户输出
192041748
系统信息
Exited with return code 0
用户输出
917164423
系统信息
Exited with return code 0
用户输出
626438667
系统信息
Exited with return code 0