結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 21:52:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 180 ms / 2,000 ms |
| コード長 | 443 bytes |
| コンパイル時間 | 2,058 ms |
| コンパイル使用メモリ | 193,600 KB |
| 最終ジャッジ日時 | 2025-02-21 00:17:41 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void solve() {
int N;
cin >> N;
string S;
cin >> S;
int cnt[] = {0, 0};
string s = "-" + S + "-";
for (int i = 0; i <= N; i ++) {
if (s[i] == '-' && s[i + 1] != '-') {
cnt[s[i + 1] == 'P'] ++;
}
if (s[i + 1] == '-' && s[i] != '-') {
cnt[s[i] == 'P'] ++;
}
}
cout << (cnt[0] >= cnt[1] ? "K" : "P") << endl;
}
int main () {
int tt;
cin >> tt;
while (tt--) {
solve();
}
}