結果

問題 No.2723 Fortune-telling by Flowers
ユーザー MasKoaTSMasKoaTS
提出日時 2024-03-29 15:26:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 86,928 KB
最終ジャッジ日時 2024-03-29 15:26:18
合計ジャッジ時間 3,302 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 70 ms
73,712 KB
testcase_02 AC 116 ms
76,280 KB
testcase_03 AC 110 ms
76,952 KB
testcase_04 AC 152 ms
77,328 KB
testcase_05 AC 69 ms
86,928 KB
testcase_06 AC 39 ms
56,660 KB
testcase_07 AC 69 ms
82,520 KB
testcase_08 AC 70 ms
82,640 KB
testcase_09 AC 120 ms
76,148 KB
testcase_10 AC 74 ms
75,056 KB
testcase_11 AC 68 ms
74,944 KB
testcase_12 AC 71 ms
76,340 KB
testcase_13 AC 74 ms
79,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def solve(n, s):
    x = 0
    for ss in s.split('-'):
        if(len(ss) == 0):
            continue
        if(ss[0] == 'K' or ss[-1] == 'K'):
            x += 1
        if(ss[0] == 'P' or ss[-1] == 'P'):
            x -= 1
    if(x >= 0):
        return 'K'
    return 'P'

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