結果

問題 No.3153 probability max K
ユーザー t98slider
提出日時 2025-05-20 22:27:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 3,743 ms
コンパイル使用メモリ 251,288 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-20 22:27:55
合計ジャッジ時間 5,771 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, v, cnt = 0;
    cin >> n >> k;
    mint div = 1;
    for(int i = 0; i < n; i++){
        cin >> v;
        if(v < k) continue;
        div *= mint::raw(v);
        cnt++;
    }
    cout << ((mint::raw(k).pow(cnt) - mint::raw(k - 1).pow(cnt)) / div).val() << '\n';
}
0