結果
| 問題 |
No.2391 SAN 値チェック
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 20:08:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 583 bytes |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 82,020 KB |
| 実行使用メモリ | 80,760 KB |
| 最終ジャッジ日時 | 2025-06-12 20:14:25 |
| 合計ジャッジ時間 | 3,273 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 14 |
ソースコード
MOD = 998244353
N = int(input())
max_fact = N
fact = [1] * (max_fact)
for i in range(1, max_fact):
fact[i] = fact[i-1] * i % MOD
inv_fact = [1] * (max_fact)
if max_fact > 0:
inv_fact[max_fact-1] = pow(fact[max_fact-1], MOD-2, MOD)
for i in range(max_fact-2, -1, -1):
inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
ans = [0] * (N + 1)
for i in range(1, N + 1):
k = N - i
sign = pow(-1, k, MOD)
term = sign * fact[N-1] % MOD
inv_part = inv_fact[i-1] * pow(inv_fact[N - i], 2, MOD) % MOD
ans[i] = term * inv_part % MOD
for a in ans:
print(a)
gew1fw