結果

問題 No.2021 Not A but B
ユーザー 👑 KazunKazun
提出日時 2022-07-29 21:33:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 1,134 ms
コンパイル使用メモリ 86,500 KB
実行使用メモリ 107,668 KB
最終ジャッジ日時 2023-09-26 19:20:38
合計ジャッジ時間 5,053 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,996 KB
testcase_01 AC 73 ms
70,896 KB
testcase_02 AC 76 ms
70,836 KB
testcase_03 AC 75 ms
71,032 KB
testcase_04 AC 75 ms
70,876 KB
testcase_05 AC 75 ms
71,000 KB
testcase_06 AC 74 ms
71,024 KB
testcase_07 AC 72 ms
70,840 KB
testcase_08 AC 116 ms
94,508 KB
testcase_09 AC 115 ms
94,288 KB
testcase_10 AC 115 ms
94,496 KB
testcase_11 AC 114 ms
94,576 KB
testcase_12 AC 115 ms
94,568 KB
testcase_13 AC 115 ms
94,408 KB
testcase_14 AC 115 ms
94,540 KB
testcase_15 AC 114 ms
94,504 KB
testcase_16 AC 115 ms
94,524 KB
testcase_17 AC 114 ms
94,412 KB
testcase_18 AC 117 ms
94,604 KB
testcase_19 AC 117 ms
94,616 KB
testcase_20 AC 117 ms
94,436 KB
testcase_21 AC 86 ms
75,724 KB
testcase_22 AC 85 ms
75,776 KB
testcase_23 AC 84 ms
76,008 KB
testcase_24 AC 80 ms
75,652 KB
testcase_25 AC 85 ms
76,008 KB
testcase_26 AC 84 ms
75,768 KB
testcase_27 AC 133 ms
107,668 KB
testcase_28 AC 132 ms
107,664 KB
testcase_29 AC 125 ms
107,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=input()

E=set()
for i in range(N-1):
    if S[i:i+2]=="AA":
        E.add((i,i+1))
    elif S[i:i+2]=="AB":
        E.add((i,))
    elif S[i:i+2]=="BA":
        E.add((i+1,))
    else:
        E.add(-1)

print(len(E))
0