結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー |
![]() |
提出日時 | 2024-04-12 23:00:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 391 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 24,076 KB |
最終ジャッジ日時 | 2024-10-02 23:42:44 |
合計ジャッジ時間 | 3,543 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
import sys input = sys.stdin.readline T=int(input()) for tests in range(T): N=int(input()) S=input().strip() LIST=[] now=[] for s in S: if s=="-": if now!=[]: LIST.append(now) now=[] else: now+=[s] if now!=[]: LIST.append(now) P=0 K=0 for l in LIST: if l[0]==l[-1]=="P": P+=1 elif l[0]==l[-1]=="K": K+=1 if K>=P: print("K") else: print("P")