結果

問題 No.1894 Delete AB
ユーザー hir355hir355
提出日時 2022-04-09 01:23:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 96,308 KB
最終ジャッジ日時 2023-08-19 04:49:24
合計ジャッジ時間 3,379 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,080 KB
testcase_01 AC 90 ms
77,476 KB
testcase_02 AC 83 ms
76,780 KB
testcase_03 AC 186 ms
79,900 KB
testcase_04 AC 193 ms
80,092 KB
testcase_05 AC 172 ms
79,620 KB
testcase_06 AC 214 ms
80,520 KB
testcase_07 AC 163 ms
78,856 KB
testcase_08 AC 149 ms
77,944 KB
testcase_09 AC 120 ms
77,748 KB
testcase_10 AC 123 ms
78,188 KB
testcase_11 AC 89 ms
77,220 KB
testcase_12 AC 97 ms
77,220 KB
testcase_13 AC 79 ms
83,928 KB
testcase_14 AC 92 ms
96,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    s = input()
    st = []
    for c in s:
        if c == 'B':
            while len(st) >= 2 and st[-1] == 'B' and st[-2] == 'A':
                st.pop()
                st.pop()
        st.append(c)
    print(*st, sep='')
0