結果

問題 No.2723 Fortune-telling by Flowers
ユーザー MasKoaTSMasKoaTS
提出日時 2023-12-23 20:53:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,988 KB
最終ジャッジ日時 2023-12-23 20:53:59
合計ジャッジ時間 2,887 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,856 KB
testcase_01 AC 38 ms
9,984 KB
testcase_02 AC 86 ms
10,112 KB
testcase_03 AC 202 ms
10,752 KB
testcase_04 AC 256 ms
10,624 KB
testcase_05 AC 55 ms
14,940 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 75 ms
16,988 KB
testcase_08 AC 75 ms
16,988 KB
testcase_09 AC 85 ms
10,112 KB
testcase_10 AC 71 ms
9,984 KB
testcase_11 AC 69 ms
10,112 KB
testcase_12 AC 69 ms
11,256 KB
testcase_13 AC 73 ms
13,992 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