結果

問題 No.2723 Fortune-telling by Flowers
ユーザー prin_kemkemprin_kemkem
提出日時 2024-04-12 22:38:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,796 KB
実行使用メモリ 99,904 KB
最終ジャッジ日時 2024-04-12 22:38:59
合計ジャッジ時間 3,307 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
80,592 KB
testcase_01 AC 113 ms
81,372 KB
testcase_02 AC 128 ms
81,896 KB
testcase_03 AC 154 ms
81,708 KB
testcase_04 AC 166 ms
81,884 KB
testcase_05 AC 124 ms
99,904 KB
testcase_06 AC 121 ms
81,556 KB
testcase_07 AC 147 ms
84,512 KB
testcase_08 AC 116 ms
84,880 KB
testcase_09 AC 127 ms
81,976 KB
testcase_10 AC 120 ms
81,724 KB
testcase_11 AC 110 ms
81,264 KB
testcase_12 AC 117 ms
83,536 KB
testcase_13 AC 120 ms
87,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
from functools import cache
# import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint, shuffle
import sys
# sys.setrecursionlimit(200000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)

#################################################    

T = int(input())
for _ in range(T):
    N = int(input())
    S = list(input().split("-"))
    x = 0
    for s in S:
        if s == "" or s[0] != s[-1]: continue
        x += 1 if s[0] == "K" else -1
    print("K" if x >= 0 else "P")
0