結果

問題 No.3153 probability max K
ユーザー ha_chan
提出日時 2025-05-23 13:53:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 2,018 ms
コンパイル使用メモリ 195,712 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-23 13:53:42
合計ジャッジ時間 5,816 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<VL> VVL;
typedef long long LL;
#define all(a) (a).begin(), (a).end()
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back

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

int main() {
    int n,k;cin>>n>>k;
    mint ans=1,aaa=1;
    int a;
    rep(i,n){
        cin>>a;
        if(a<k){continue;}
        mint p=a; p=1/p;
        ans*=k*p;
        aaa*=(k-1)*p;
    }
    ans-=aaa;
    cout<<ans.val()<<endl;
}
0