結果

問題 No.1894 Delete AB
ユーザー ThetaTheta
提出日時 2022-10-11 19:21:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 710 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2023-09-07 20:17:54
合計ジャッジ時間 5,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,764 KB
testcase_01 AC 710 ms
8,736 KB
testcase_02 AC 683 ms
8,684 KB
testcase_03 AC 82 ms
7,796 KB
testcase_04 AC 87 ms
7,804 KB
testcase_05 AC 90 ms
7,828 KB
testcase_06 AC 90 ms
7,848 KB
testcase_07 AC 91 ms
7,800 KB
testcase_08 AC 96 ms
7,796 KB
testcase_09 AC 42 ms
7,860 KB
testcase_10 AC 50 ms
7,792 KB
testcase_11 AC 62 ms
7,920 KB
testcase_12 AC 95 ms
8,124 KB
testcase_13 AC 682 ms
8,676 KB
testcase_14 AC 662 ms
8,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    T = int(input())
    for _ in range(T):
        _ = input()
        S = input()
        A_idx = len(S)+1
        while len(S) > 2:
            A_idx = S.rfind("ABB", None, A_idx)
            if A_idx == -1:
                break
            S = S[:A_idx] + S[A_idx+2:]
            A_idx += 2

        print(S)


if __name__ == "__main__":
    main()
0