結果
| 問題 | No.2723 Fortune-telling by Flowers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 21:46:30 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 278 ms / 2,000 ms |
| + 38µs | |
| コード長 | 501 bytes |
| 記録 | |
| コンパイル時間 | 74 ms |
| コンパイル使用メモリ | 80,640 KB |
| 実行使用メモリ | 149,244 KB |
| 最終ジャッジ日時 | 2026-09-09 07:02:38 |
| 合計ジャッジ時間 | 3,113 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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")