結果

問題 No.2394 部分和乗総和
ユーザー hitonanode
提出日時 2023-08-05 11:42:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 08:47:09
合計ジャッジ時間 2,016 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

#include <atcoder/modint>
using mint = atcoder::modint;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int N, B;
    long long M;
    cin >> N >> M >> B;
    mint::set_mod(B);

    mint m = M, ret = 1;

    while (N--) {
        long long a;
        cin >> a;
        ret *= 1 + m.pow(a);
    }
    cout << ret.val() << '\n';
}
0