結果

問題 No.2723 Fortune-telling by Flowers
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-12 22:08:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 95,148 KB
最終ジャッジ日時 2024-04-12 22:08:50
合計ジャッジ時間 3,071 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,572 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 380 ms
77,784 KB
testcase_04 WA -
testcase_05 AC 81 ms
95,148 KB
testcase_06 AC 40 ms
55,832 KB
testcase_07 AC 70 ms
83,288 KB
testcase_08 AC 70 ms
82,772 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 72 ms
75,200 KB
testcase_12 WA -
testcase_13 AC 79 ms
82,172 KB
権限があれば一括ダウンロードができます

ソースコード

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