結果

問題 No.2723 Fortune-telling by Flowers
ユーザー 👑 rin204rin204
提出日時 2024-04-12 22:48:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 373 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,540 KB
実行使用メモリ 86,704 KB
最終ジャッジ日時 2024-04-12 22:48:07
合計ジャッジ時間 3,111 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,556 KB
testcase_01 AC 112 ms
77,232 KB
testcase_02 AC 179 ms
77,776 KB
testcase_03 AC 331 ms
76,692 KB
testcase_04 AC 373 ms
76,916 KB
testcase_05 AC 72 ms
86,704 KB
testcase_06 AC 42 ms
56,552 KB
testcase_07 AC 68 ms
82,520 KB
testcase_08 AC 77 ms
82,272 KB
testcase_09 AC 182 ms
77,304 KB
testcase_10 AC 101 ms
76,016 KB
testcase_11 AC 65 ms
74,544 KB
testcase_12 AC 63 ms
76,544 KB
testcase_13 AC 66 ms
79,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    S = input()
    T = S.split("-")
    c = 0
    for t in T:
        if t == "":
            continue
        elif t[0] == t[-1]:
            if t[0] == "P":
                c += 1
            else:
                c -= 1
    return c > 0


for _ in range(int(input())):
    if solve():
        print("P")
    else:
        print("K")
0