結果

問題 No.1927 AB-CD
ユーザー 👑 colognecologne
提出日時 2022-05-10 14:39:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 86,500 KB
実行使用メモリ 77,264 KB
最終ジャッジ日時 2023-09-24 19:46:55
合計ジャッジ時間 6,158 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,272 KB
testcase_01 AC 73 ms
70,964 KB
testcase_02 AC 73 ms
71,220 KB
testcase_03 AC 71 ms
71,196 KB
testcase_04 AC 150 ms
76,960 KB
testcase_05 AC 133 ms
77,200 KB
testcase_06 AC 131 ms
76,956 KB
testcase_07 AC 125 ms
76,708 KB
testcase_08 AC 83 ms
75,956 KB
testcase_09 AC 137 ms
76,728 KB
testcase_10 AC 121 ms
76,816 KB
testcase_11 AC 132 ms
76,900 KB
testcase_12 AC 103 ms
76,776 KB
testcase_13 AC 105 ms
76,612 KB
testcase_14 AC 82 ms
76,080 KB
testcase_15 AC 94 ms
76,464 KB
testcase_16 AC 133 ms
76,912 KB
testcase_17 AC 122 ms
76,860 KB
testcase_18 AC 122 ms
76,972 KB
testcase_19 AC 126 ms
76,864 KB
testcase_20 AC 143 ms
77,152 KB
testcase_21 AC 129 ms
76,872 KB
testcase_22 AC 100 ms
76,728 KB
testcase_23 AC 149 ms
77,116 KB
testcase_24 AC 154 ms
77,136 KB
testcase_25 AC 152 ms
77,148 KB
testcase_26 AC 155 ms
77,264 KB
testcase_27 AC 72 ms
70,972 KB
testcase_28 AC 70 ms
71,156 KB
testcase_29 AC 71 ms
70,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    S = input()
    M = S.count('A') + S.count('B')

    ans = 1
    for i in range(M):
        ans = ans * (N-i) * pow(i+1, -1, 998244353)
        ans %= 998244353

    print(ans)


if __name__ == '__main__':
    main()
0