結果
| 問題 | No.2723 Fortune-telling by Flowers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 21:52:35 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 443 bytes |
| 記録 | |
| コンパイル時間 | 1,150 ms |
| コンパイル使用メモリ | 214,660 KB |
| 実行使用メモリ | 11,932 KB |
| 最終ジャッジ日時 | 2026-07-04 11:24:20 |
| 合計ジャッジ時間 | 2,360 ms |
|
ジャッジサーバーID (参考情報) |
temp-judge_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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();
}
}