結果

問題 No.2723 Fortune-telling by Flowers
ユーザー eve__fuyuki
提出日時 2024-04-12 22:08:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 95,008 KB
最終ジャッジ日時 2024-10-02 23:20:54
合計ジャッジ時間 2,777 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
	n = int(input())
	a = input().split("-")
	pp, pk, kk = 0, 0, 0
	for i in a:
		if len(i) == 0:
			continue
		if i[0] == 'P' and i[-1] == 'P':
			pp += 1
		elif i[0] == 'K' and i[-1] == 'K':
			kk += 1
		else:
			pk += 1
	kk += (pk + 1) // 2
	pp += pk // 2
	if kk >= pp:
		print("K")
	else:
		print("P")
0