結果

問題 No.2299 Antitypoglycemia
ユーザー koarakko5555koarakko5555
提出日時 2023-05-12 21:44:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 879 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 82,004 KB
実行使用メモリ 112,896 KB
最終ジャッジ日時 2024-05-06 11:31:53
合計ジャッジ時間 9,459 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 39 ms
52,224 KB
testcase_03 AC 429 ms
88,832 KB
testcase_04 AC 433 ms
89,088 KB
testcase_05 AC 218 ms
79,616 KB
testcase_06 AC 423 ms
88,960 KB
testcase_07 AC 83 ms
75,704 KB
testcase_08 AC 387 ms
88,064 KB
testcase_09 AC 439 ms
89,776 KB
testcase_10 AC 131 ms
76,920 KB
testcase_11 AC 142 ms
76,736 KB
testcase_12 AC 502 ms
92,288 KB
testcase_13 AC 824 ms
110,080 KB
testcase_14 AC 64 ms
75,264 KB
testcase_15 AC 65 ms
75,088 KB
testcase_16 AC 145 ms
77,440 KB
testcase_17 AC 90 ms
75,176 KB
testcase_18 AC 618 ms
100,284 KB
testcase_19 AC 608 ms
99,968 KB
testcase_20 AC 879 ms
112,896 KB
testcase_21 AC 879 ms
112,848 KB
testcase_22 AC 604 ms
99,944 KB
testcase_23 AC 37 ms
52,096 KB
testcase_24 AC 38 ms
52,096 KB
testcase_25 AC 38 ms
52,224 KB
testcase_26 AC 36 ms
52,352 KB
testcase_27 AC 37 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**5)
import math

def re_factorial(n):
    if n < 2:
        return 1
    return n * re_factorial(n-1)

N, A, B = map(int, input().split())
mod = 998244353

#全体-Aのとき-Bのとき+AかつBのとき

#全体
#zentai = re_factorial(N)
zentai = math.factorial(N)

#Aのとき
#a = re_factorial(N-1)
a = math.factorial(N-1)
b = a
#Bのとき
#b = re_factorial(N-1)

#AかつBのとき
ab = 0
if A!=B:
    ab = math.factorial(N-2)

#print(zentai, a, b, ab)
ans = zentai - a - b + ab
print(ans%mod)
0