結果

問題 No.2299 Antitypoglycemia
ユーザー 👑 rin204
提出日時 2024-03-16 16:10:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 59,112 KB
最終ジャッジ日時 2024-09-30 04:05:17
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n, a, b = map(int, input().split())
if a == b:
    ans = n - 2
    for i in range(1, n):
        ans *= i
        ans %= MOD
    print(ans)
else:
    prod = 1
    for i in range(1, n - 1):
        prod *= i
        prod %= MOD

    ans = prod + 2 * (n - 2) * prod + (n - 2) * (n - 3) * prod
    print(ans % MOD)
0