結果
| 問題 | No.3153 probability max K | 
| コンテスト | |
| ユーザー |  pengin_2000 | 
| 提出日時 | 2025-05-20 21:33:51 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 713 bytes | 
| コンパイル時間 | 185 ms | 
| コンパイル使用メモリ | 26,836 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-05-20 21:33:56 | 
| 合計ジャッジ時間 | 4,142 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | WA * 20 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:25:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |         scanf("%lld %lld", &n, &k);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:28:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |                 scanf("%lld", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<stdio.h>
long long int modpow(long long int a, long long int n, long long int p)
{
	long long int res = 1;
	for (; n > 0; n /= 2, a = a * a % p)
		if (n % 2 > 0)
			res = res * a % p;
	return res;
}
long long int n;
long long int a[200005];
long long int cal(long long int k, long long int p)
{
	long long int i, res = 1;
	for (i = 0; i < n; i++)
	{
		if (a[i] > k)
			res = res * k % p * modpow(a[i], p - 2, p);
	}
	return res;
}
int main()
{
	long long int k;
	scanf("%lld %lld", &n, &k);
	long long int i;
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	const long long int p = 998244353;
	long long int ans = cal(k, p) - cal(k - 1, p);
	ans = (ans % p + p) % p;
	printf("%lld\n", ans);
	return 0;
}
            
            
            
        