| Task: | Peli |
| Sender: | ollpu |
| Submission time: | 2020-11-06 18:38:39 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 35 |
| #2 | ACCEPTED | 65 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 1, 2 | details |
| #2 | ACCEPTED | 0.01 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:21:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
if ((b-a)%2 == 0) cout << "1\n";
~~^~~
input/code.cpp:21:11: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]Code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
for (int Ti = 0; Ti < T; ++Ti) {
string s;
cin >> s;
int n = s.size();
bool af = 0;
int a, b;
for (int i = 0; i < n; ++i) {
if (s[i] == 'P') {
if (!af) a = i;
else b = i;
af = 1;
}
}
if ((b-a)%2 == 0) cout << "1\n";
else cout << "2\n";
}
}
