結果

問題 No.2723 Fortune-telling by Flowers
ユーザー MasKoaTSMasKoaTS
提出日時 2023-12-20 23:06:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 86,940 KB
最終ジャッジ日時 2023-12-25 18:17:12
合計ジャッジ時間 2,458 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 73 ms
75,852 KB
testcase_02 AC 114 ms
76,248 KB
testcase_03 AC 131 ms
77,216 KB
testcase_04 AC 155 ms
77,860 KB
testcase_05 AC 70 ms
86,940 KB
testcase_06 AC 39 ms
56,668 KB
testcase_07 AC 72 ms
82,516 KB
testcase_08 AC 72 ms
82,508 KB
testcase_09 AC 115 ms
76,240 KB
testcase_10 AC 75 ms
75,028 KB
testcase_11 AC 66 ms
74,772 KB
testcase_12 AC 66 ms
75,384 KB
testcase_13 AC 68 ms
77,500 KB
権限があれば一括ダウンロードができます

ソースコード

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