結果

問題 No.2723 Fortune-telling by Flowers
ユーザー titia
提出日時 2024-04-12 22:56:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,072 KB
最終ジャッジ日時 2024-10-02 23:40:39
合計ジャッジ時間 3,588 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 3 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T=int(input())
for tests in range(T):
    N=int(input())
    S=input().strip()

    LIST=[]
    now=[]
    for s in S:
        if s=="-":
            if now!=[]:
                LIST.append(now)
            now=[]
        else:
            now+=[s]

    P=0
    K=0

    for l in LIST:
        if l[0]==l[-1]=="P":
            P+=1
        elif l[0]==l[-1]=="K":
            K+=1

    if K>P:
        print("K")
    else:
        print("P")
0