結果

問題 No.2723 Fortune-telling by Flowers
ユーザー titiatitia
提出日時 2024-04-12 22:29:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 24,204 KB
最終ジャッジ日時 2024-04-12 22:29:35
合計ジャッジ時間 4,069 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 136 ms
11,772 KB
testcase_06 WA -
testcase_07 AC 242 ms
24,204 KB
testcase_08 AC 240 ms
24,072 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 224 ms
18,552 KB
権限があれば一括ダウンロードができます

ソースコード

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