結果
| 問題 |
No.1894 Delete AB
|
| コンテスト | |
| ユーザー |
googol_S0
|
| 提出日時 | 2022-04-08 22:16:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 150 ms / 2,000 ms |
| コード長 | 303 bytes |
| コンパイル時間 | 353 ms |
| コンパイル使用メモリ | 82,348 KB |
| 実行使用メモリ | 77,496 KB |
| 最終ジャッジ日時 | 2024-11-28 12:56:24 |
| 合計ジャッジ時間 | 2,439 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 |
ソースコード
def solve():
N=int(input())
S=input()[::-1]
Q=[]
for i in range(N):
Q.append(S[i])
if len(Q)>=2 and Q[-1]=='A' and Q[-2]=='B':
if len(Q)==2:
continue
if Q[-3]=='B':
del Q[-1]
del Q[-1]
print(''.join(Q[::-1]))
for t in range(int(input())):
solve()
googol_S0