結果
| 問題 | No.3153 probability max K | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-05-21 00:04:22 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 657 bytes | 
| コンパイル時間 | 1,663 ms | 
| コンパイル使用メモリ | 165,548 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-05-21 00:04:26 | 
| 合計ジャッジ時間 | 3,812 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | WA * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
const ll  MOD=998244353;
ll f(ll x,ll n){
    ll res=1;
    while(n!=0LL){
	if(n%2!=0LL) res=(res*x)%MOD;
	x=(x*x)%MOD;
	n/=2;
   }
    return res;
}
int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;
	ll N,K;
	cin >> N >> K;
	vector<ll> a(N+1);
	for(i=1;i<=N;i++){
		cin >> a[i];
	}
	ll x=1,y=1;
	for(i=1;i<=N;i++){
		if(a[i]<K) continue;
		ll q=f(a[i],MOD-2);
		x*=q*K;
		x%=MOD;
		y*=q*(K-1);
		y%=MOD;
	}
	cout << (x-y+MOD)%MOD << endl;
	return 0;
}
            
            
            
        