結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
MasKoaTS
|
| 提出日時 | 2024-03-29 15:26:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 2,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 282 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 87,220 KB |
| 最終ジャッジ日時 | 2024-09-30 15:03:11 |
| 合計ジャッジ時間 | 2,272 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
import sys
input = sys.stdin.readline
def solve(n, s):
x = 0
for ss in s.split('-'):
if(len(ss) == 0):
continue
if(ss[0] == 'K' or ss[-1] == 'K'):
x += 1
if(ss[0] == 'P' or ss[-1] == 'P'):
x -= 1
if(x >= 0):
return 'K'
return 'P'
t = int(input())
for _ in [0] * t:
n = int(input())
s = input()[:-1]
print(solve(n, s))
MasKoaTS