結果

問題 No.1894 Delete AB
ユーザー lloyzlloyz
提出日時 2022-04-08 23:24:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,339 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 147,472 KB
最終ジャッジ日時 2023-08-19 01:59:10
合計ジャッジ時間 4,224 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,416 KB
testcase_01 AC 97 ms
76,976 KB
testcase_02 AC 81 ms
76,820 KB
testcase_03 AC 117 ms
77,432 KB
testcase_04 AC 131 ms
77,872 KB
testcase_05 AC 113 ms
77,260 KB
testcase_06 AC 132 ms
77,788 KB
testcase_07 AC 117 ms
77,344 KB
testcase_08 AC 116 ms
77,440 KB
testcase_09 AC 94 ms
77,620 KB
testcase_10 AC 93 ms
77,244 KB
testcase_11 AC 79 ms
76,728 KB
testcase_12 AC 80 ms
76,872 KB
testcase_13 AC 1,339 ms
147,472 KB
testcase_14 AC 73 ms
77,188 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