結果
問題 |
No.2629 A replace B replace C
|
ユーザー |
👑 |
提出日時 | 2024-02-18 17:39:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 387 bytes |
コンパイル時間 | 229 ms |
コンパイル使用メモリ | 82,392 KB |
実行使用メモリ | 75,916 KB |
最終ジャッジ日時 | 2024-09-29 00:43:49 |
合計ジャッジ時間 | 5,146 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 61 |
ソースコード
n = int(input()) S = input() T = input() f = False ab = 0 bc = 0 for s, t in zip(S, T): if s == "A" and t == "B": ab += 1 elif s == "B" and t == "C": bc += 1 f = True elif s == "A" and t == "C": ab += 1 bc += 1 elif s != t: print("No") exit() if (f or ab == 0) and ab == bc: print("Yes") else: print("No")