結果

問題 No.2723 Fortune-telling by Flowers
ユーザー 👑 rin204
提出日時 2024-04-12 22:48:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 396 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,368 KB
実行使用メモリ 86,652 KB
最終ジャッジ日時 2024-10-02 23:37:38
合計ジャッジ時間 2,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    S = input()
    T = S.split("-")
    c = 0
    for t in T:
        if t == "":
            continue
        elif t[0] == t[-1]:
            if t[0] == "P":
                c += 1
            else:
                c -= 1
    return c > 0


for _ in range(int(input())):
    if solve():
        print("P")
    else:
        print("K")
0