結果

問題 No.2723 Fortune-telling by Flowers
ユーザー flygonflygon
提出日時 2024-04-12 22:53:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 427 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 81,964 KB
実行使用メモリ 99,964 KB
最終ジャッジ日時 2024-04-12 22:53:20
合計ジャッジ時間 3,649 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,616 KB
testcase_01 AC 110 ms
77,176 KB
testcase_02 AC 148 ms
77,100 KB
testcase_03 AC 367 ms
77,648 KB
testcase_04 AC 427 ms
77,616 KB
testcase_05 AC 45 ms
62,524 KB
testcase_06 AC 80 ms
90,352 KB
testcase_07 AC 95 ms
91,416 KB
testcase_08 AC 98 ms
91,792 KB
testcase_09 AC 183 ms
77,512 KB
testcase_10 AC 130 ms
77,340 KB
testcase_11 AC 96 ms
76,096 KB
testcase_12 AC 108 ms
82,672 KB
testcase_13 AC 136 ms
99,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())

for i in range(t):
    n = int(input())
    s = "-" + input().rstrip()
    d = []
    for i in range(1,n+1):
        if s[i] == "-": continue
        if s[i-1] == "-":
            d.append([s[i]])
        else:
            d[-1].append(s[i])
    
    k = 0
    p = 0
    for i in range(len(d)):
        k += d[i][0] == "K" and d[i][-1] == "K"
        p += d[i][0] == "P" and d[i][-1] == "P"
    
    if p > k:
        print("P")
    else:
        print("K")


0