結果

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

ソースコード

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