結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 21:36:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 446 bytes |
| コンパイル時間 | 638 ms |
| コンパイル使用メモリ | 64,996 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-02 23:04:46 |
| 合計ジャッジ時間 | 1,461 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;cin>>T;
for(;T--;)
{
int N;
string S;
cin>>N>>S;
int K=0,P=0,KP=0;
for(int i=0;i<N;i++)
{
if(S[i]!='-')
{
char f=S[i];
while(i+1<N&&S[i+1]!='-')i++;
char g=S[i];
if(f!=g)KP++;
else if(f=='K')K++;
else P++;
}
}
if(K!=P)cout<<(K>P?"K\n":"P\n");
else cout<<"K\n";
}
}