結果
| 問題 | 
                            No.1481 Rotation ABC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-05-07 10:41:51 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 232 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 14,264 KB | 
| 最終ジャッジ日時 | 2024-09-14 23:22:47 | 
| 合計ジャッジ時間 | 11,574 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 28 WA * 10 | 
ソースコード
#yuki1481
from math import *
mod=998244353
n=int(input())
s=input()
x=s.count('A')
y=s.count('B')
z=s.count('C')
if x==0 or y==0 or z==0:
 print(1)
 exit()
res=factorial(n)//(factorial(x)*factorial(y)*factorial(z))-n
print(res%mod)