結果

問題 No.2723 Fortune-telling by Flowers
ユーザー ニックネームニックネーム
提出日時 2024-04-12 22:39:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 941 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,908 KB
最終ジャッジ日時 2024-04-12 22:39:23
合計ジャッジ時間 5,429 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 62 ms
10,752 KB
testcase_02 AC 260 ms
10,752 KB
testcase_03 AC 875 ms
10,752 KB
testcase_04 AC 941 ms
10,752 KB
testcase_05 AC 150 ms
11,776 KB
testcase_06 AC 284 ms
11,908 KB
testcase_07 AC 202 ms
11,648 KB
testcase_08 AC 206 ms
11,772 KB
testcase_09 AC 251 ms
10,752 KB
testcase_10 AC 197 ms
10,752 KB
testcase_11 AC 212 ms
10,624 KB
testcase_12 AC 256 ms
11,008 KB
testcase_13 AC 208 ms
11,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input()); s = input()+"-"; k = p = 0
    for i in range(n):
        if s[i]=="K" and s[i-1]!="K": k += 1
        if s[i]=="P" and s[i-1]!="P": p += 1
    print("K" if k>=p else "P")
0