Task: | Peli |
Sender: | Grez |
Submission time: | 2020-11-07 09:30:35 +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 |
Code
#include <iostream> using namespace std; int main() { int amo; cin >> amo; for (int i = 0; i < amo; i++) { string peli; cin >> peli; int c = 0; bool started = false; for (int i = peli.size() - 1; i >= 0; i--) { if (peli[i] == 'P') { if (started) { cout << (2 - (c & 1)) << endl; break; } else { c = 1; started = true; } } c++; } } }