結果

問題 No.3153 probability max K
ユーザー Ponzu
提出日時 2025-05-20 23:04:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 90,160 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-20 23:04:27
合計ジャッジ時間 4,552 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<utility>
using namespace std;
#include<atcoder/modint>
using mint = atcoder::modint998244353;
int main(){
	int N,K;cin>>N>>K;
	vector<int> A(N);
	mint sum = 1;
	mint c = 1;
	mint d = 1;
	for(int i=0;i<N;++i){
		cin>>A[i];
		if(A[i]<K)continue;
		c *= K;
		c /= A[i];

		d *= K-1;
		d /= A[i];
	}
	mint ans = c - d;
	cout << ans.val() << endl;
	
}
0