結果

問題 No.3395 Range Flipping Game
コンテスト
ユーザー Yakumo221
提出日時 2025-12-02 17:35:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 88,820 KB
最終ジャッジ日時 2025-12-02 17:35:48
合計ジャッジ時間 5,692 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

t = int(input())
while t:
	t -= 1
	
	n = int(input())
	s = input()
	
	if n == 1:
		print("B")
		continue
	if n == 2:
		print("BB")
		continue
	
	s = list(s)
	if (s[0] == "A") & (s[1] == "B"):
		l = 2
		s[0] = "B"
		while l < n:
			if s[l] == "A":
				l += 1
				continue
			r = l
			while r < n:
				if s[r] == "B":
					s[r] = "A"
					r += 1
					continue
				else:
					break
			break
			
	else:
		s[0] = "B"
		s[1] = "B"
	
	print("".join(s))
		
0