結果

問題 No.1927 AB-CD
ユーザー titiatitia
提出日時 2022-05-06 21:33:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 476 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 10,840 KB
実行使用メモリ 24,332 KB
最終ジャッジ日時 2023-09-20 02:26:28
合計ジャッジ時間 6,713 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
23,724 KB
testcase_01 AC 129 ms
23,728 KB
testcase_02 AC 127 ms
23,664 KB
testcase_03 AC 132 ms
23,688 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 155 ms
23,912 KB
testcase_08 AC 129 ms
23,904 KB
testcase_09 RE -
testcase_10 AC 152 ms
23,972 KB
testcase_11 RE -
testcase_12 AC 141 ms
24,040 KB
testcase_13 AC 145 ms
23,912 KB
testcase_14 AC 134 ms
23,996 KB
testcase_15 AC 136 ms
24,036 KB
testcase_16 RE -
testcase_17 AC 153 ms
23,876 KB
testcase_18 AC 150 ms
24,024 KB
testcase_19 AC 156 ms
23,904 KB
testcase_20 RE -
testcase_21 AC 153 ms
23,980 KB
testcase_22 AC 138 ms
23,972 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 128 ms
23,724 KB
testcase_28 AC 125 ms
23,796 KB
testcase_29 AC 130 ms
23,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
S=input().strip()

mod=998244353

FACT=[1]
for i in range(1,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod
    else:
        return 0

x=0
for s in S:
    if s=="A" or s=="B":
        x+=1

print(Combi(N,x))

0