0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 16:58:48 +00:00

P4144 大河的序列

R55005183
This commit is contained in:
Baoshuo Ren 2021-08-05 08:54:56 +08:00 committed by Baoshuo Ren
parent 14ef00da69
commit 174a44ee47
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,27 @@
#include <bits/stdc++.h>
using namespace std;
int n, b;
long long p, a, x;
long long binpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1) res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
int main() {
cin >> n >> b >> p;
for (int i = 1; i <= n; i++) {
cin >> a;
x = max(a, x);
}
cout << binpow(2 * x + 233, b, p) % p << endl;
return 0;
}