結果

問題 No.2723 Fortune-telling by Flowers
ユーザー MasKoaTS
提出日時 2023-12-23 20:53:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,768 KB
最終ジャッジ日時 2024-09-27 12:38:37
合計ジャッジ時間 2,474 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline


def solve(n, s):
    score = 0
    for ss in s.split('-'):
        if not(ss):
            continue
        lis = [ss[0], ss[-1]]
        score += ('K' in lis) - ('P' in lis)
    return 'K' if(score >= 0) else 'P'


t = int(input())
for _ in [0] * t:
    n = int(input())
    s = input()[:-1]
    print(solve(n, s))
0