結果
| 問題 | No.2299 Antitypoglycemia |
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-05-12 21:58:03 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 32 ms / 2,000 ms |
| + 13µs | |
| コード長 | 712 bytes |
| 記録 | |
| コンパイル時間 | 70 ms |
| コンパイル使用メモリ | 81,212 KB |
| 実行使用メモリ | 61,312 KB |
| 最終ジャッジ日時 | 2026-10-01 12:51:58 |
| 合計ジャッジ時間 | 2,950 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
# 包除原理だな
mod = 998244353
N, A, B = map(int, input().split())
if A != B:
total = 1
for i in range(1, N+1):
total *= i
total %= mod
deduct1 = 1
for i in range(1, N):
deduct1 *= i
deduct1 %= mod
add1 = 1
for i in range(1, N-1):
add1 *= i
add1 %= mod
ans = (total - deduct1*2 + add1)%mod
#print(total, deduct1, add1)
print(ans)
elif A == B:
total = 1
for i in range(1, N+1):
total *= i
total %= mod
deduct1 = 1
for i in range(1, N):
deduct1 *= i
deduct1 %= mod
add1 = 0
ans = (total - deduct1*2 + add1)%mod
#print(total, deduct1, add1)
print(ans)
FromBooska