結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 21:46:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 403 ms / 2,000 ms |
| コード長 | 501 bytes |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 151,964 KB |
| 最終ジャッジ日時 | 2024-10-02 23:11:39 |
| 合計ジャッジ時間 | 3,292 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
T = int(input())
for _ in range(T):
N = int(input())
S = list(input())
now = S[0]
cnt = 1
dat = []
for i in range(1, N):
if S[i] != now:
dat.append([now, cnt])
cnt = 1
now = S[i]
else:
cnt += 1
dat.append([now, cnt])
# print(dat)
cntp, cntk = 0, 0
for c, _ in dat:
if c == 'P':
cntp += 1
if c == 'K':
cntk += 1
print("K" if cntp <= cntk else "P")