0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-28 01:51:59 +00:00
OI-codes/Luogu/problem/P4144/P4144.cpp
2021-08-05 08:54:56 +08:00

28 lines
480 B
C++

#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;
}