結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
kokosei
|
| 提出日時 | 2024-04-13 20:13:59 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 691 ms |
| コンパイル使用メモリ | 79,104 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-03 00:21:15 |
| 合計ジャッジ時間 | 1,360 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
using ll = long long;
int N;
string S;
void solve(){
cin >> N >> S;
S += '-';
int G = 0;
for(int i = 0;i < N;i++){
if(S[i] == '-')continue;
string t;
while(S[i] != '-')t += S[i], i++;
if(t.front() != t.back())continue;
G += (t.front() == 'K' ? 1 : -1);
}
cout << (G >= 0 ? "K\n" : "P\n");
}
int main(void){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while(t--)solve();
return 0;
}
kokosei