結果
| 問題 | No.2394 部分和乗総和 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-27 17:05:41 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 448 bytes |
| 記録 | |
| コンパイル時間 | 1,203 ms |
| コンパイル使用メモリ | 211,712 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-02 13:03:55 |
| 合計ジャッジ時間 | 2,402 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll modpow(ll a,ll n,int mod){
long long ret=1,t=a;
while(n>0){
if(n&1)ret=ret*t%mod;
t=t*t%mod;
n/=2;
}
return ret;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
ll M,B;
cin>>N>>M>>B;
M%=B;
vector A(N,0ll);
for(ll &i:A)cin>>i;
ll ans=1;
for(int i=0;i<N;i++){
ans=ans*(modpow(M,A[i],B)+1)%B;
}
cout<<ans<<'\n';
}