結果

問題 No.2021 Not A but B
ユーザー deepjugglingdeepjuggling
提出日時 2023-01-17 22:52:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 79,444 KB
最終ジャッジ日時 2023-08-31 01:20:17
合計ジャッジ時間 4,154 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,332 KB
testcase_01 AC 69 ms
71,208 KB
testcase_02 AC 73 ms
71,368 KB
testcase_03 AC 70 ms
71,172 KB
testcase_04 AC 69 ms
71,452 KB
testcase_05 AC 71 ms
71,216 KB
testcase_06 AC 70 ms
71,212 KB
testcase_07 AC 70 ms
71,136 KB
testcase_08 AC 89 ms
79,344 KB
testcase_09 AC 88 ms
79,284 KB
testcase_10 AC 87 ms
79,328 KB
testcase_11 AC 86 ms
79,224 KB
testcase_12 AC 86 ms
79,260 KB
testcase_13 AC 86 ms
79,444 KB
testcase_14 AC 87 ms
79,352 KB
testcase_15 AC 89 ms
79,036 KB
testcase_16 AC 87 ms
79,280 KB
testcase_17 AC 89 ms
79,216 KB
testcase_18 AC 87 ms
79,396 KB
testcase_19 AC 88 ms
79,180 KB
testcase_20 AC 90 ms
79,280 KB
testcase_21 AC 81 ms
75,736 KB
testcase_22 AC 79 ms
75,912 KB
testcase_23 AC 81 ms
75,864 KB
testcase_24 AC 74 ms
75,668 KB
testcase_25 AC 80 ms
76,068 KB
testcase_26 AC 79 ms
79,160 KB
testcase_27 AC 83 ms
79,168 KB
testcase_28 AC 84 ms
79,088 KB
testcase_29 AC 80 ms
79,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
s = list(s)
if n == 2:
    print(1)
    exit()
fra = 0
an = ["B","B",s[2]]
ans = 1
if s[0] == "B" and s[1] == "B":
    fra = 1
for i in range(n-2):
    if s[i+1] == "B" and s[i+2] == "B":
        if fra == 0:
            fra = 1
        else:
            continue
    if s[i] != "B" or s[i+2] != "B":
        ans += 1
print(ans)
0