Task: | Peli |
Sender: | Lieska |
Submission time: | 2020-11-06 18:26:38 +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 'void testi()': input/code.cpp:10:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=1; i<=s.size(); ++i){ ~^~~~~~~~~~
Code
#include <bits/stdc++.h>using namespace std;typedef long long ll;void testi(){string s;cin >> s;int a=0, b=0;for (int i=1; i<=s.size(); ++i){if (s[i-1]=='P'){if (a) b=i;else a=i;}}if ((b-a)%2==0) cout << "1\n";else cout << "2\n";}int main(){ios_base::sync_with_stdio(0);cin.tie(0);//�l� k�yt�, jos teht�v� on interaktiivinen!int t;cin >> t;while (t--) testi();}