結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-04-12 21:33:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 569 bytes |
| コンパイル時間 | 2,062 ms |
| コンパイル使用メモリ | 193,228 KB |
| 最終ジャッジ日時 | 2025-02-21 00:08:52 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin>>T;
while(T--)
{
int N;
string S;
cin>>N>>S;
int P=0,K=0;
for(int i=0;i<N;i++)
{
if(S[i]=='P')
{
P++;
while(i+1<N&&S[i+1]=='P')i++;
}
else if(S[i]=='K')
{
K++;
while(i+1<N&&S[i+1]=='K')i++;
}
}
cout<<(P>K?'P':'K')<<'\n';
}
}
nonon