用户输出
25646167
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#81207 | #110. czq的模法数列 | Accepted | 100 | 42 ms | 384 K | C++ 11 / 542 B | Corycle | 2022-08-26 13:24:09 |
/*====Corycle====*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int inf = 0x3f3f3f3f;
int read() {
int s = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
s = s * 10 + c - '0';
c = getchar();
}
return s * f;
}
int n, q, ans, mod;
int main() {
// freopen("_.in","r",stdin);
// freopen("_.out","w",stdout);
n = read();
q = read();
mod = read();
q = (q % mod + mod) % mod;
int x = 1;
for (int i = 1; i <= n; i++) {
ans = (ans + x) % mod;
x = 1ll * x * q % mod;
}
printf("%d\n", ans);
return 0;
}
用户输出
192041748
系统信息
Exited with return code 0
用户输出
917164423
系统信息
Exited with return code 0
用户输出
626438667
系统信息
Exited with return code 0