結果

問題 No.1894 Delete AB
ユーザー lloyzlloyz
提出日時 2022-04-08 23:24:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,843 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 146,048 KB
最終ジャッジ日時 2024-05-06 09:08:52
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,584 KB
testcase_01 AC 107 ms
75,904 KB
testcase_02 AC 78 ms
75,392 KB
testcase_03 AC 119 ms
76,032 KB
testcase_04 AC 140 ms
76,672 KB
testcase_05 AC 113 ms
76,080 KB
testcase_06 AC 142 ms
76,544 KB
testcase_07 AC 116 ms
76,396 KB
testcase_08 AC 118 ms
76,288 KB
testcase_09 AC 88 ms
76,288 KB
testcase_10 AC 91 ms
76,288 KB
testcase_11 AC 74 ms
75,632 KB
testcase_12 AC 77 ms
75,284 KB
testcase_13 AC 1,843 ms
146,048 KB
testcase_14 AC 65 ms
75,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    S = input()
    ANS = ''
    for i in range(n - 1, -1, -1):
        ANS = S[i] + ANS
        if ANS[:2] == "AB":
            if len(ANS) > 2 and ANS[2] == 'B':
                ANS = ANS[2:]
    print(ANS)
0