結果

問題 No.2299 Antitypoglycemia
コンテスト
ユーザー yassu0320
提出日時 2023-03-13 12:41:20
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 62 ms / 2,000 ms
+ 989µs
コード長 506 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 86 ms
コンパイル使用メモリ 65,088 KB
実行使用メモリ 63,064 KB
最終ジャッジ日時 2026-10-14 20:34:44
合計ジャッジ時間 4,637 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from typing import Dict, Iterable, Set


def inputs(type_=int):
    ins = input().split()

    if isinstance(type_, Iterable):
        return [t(x) for t, x in zip(type_, ins)]
    else:
        return list(map(type_, ins))


n, a, b = inputs()
M = 2 * 10**5 + 10
facs = [1] * M
mod = 998244353

for i in range(1, M):
    facs[i] = facs[i - 1] * i
    facs[i] %= mod

if a != b:
    res = facs[n - 1] + (n - 2) * (n - 2) * facs[n - 2]
else:
    res = (n - 1) * (n - 2) * facs[n - 2]

res %= mod
print(res)
0