0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 07:51:59 +00:00
OI-codes/Luogu/P4144/P4144.cpp

28 lines
480 B
C++
Raw Normal View History

2021-08-05 00:54:56 +00:00
#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;
}