| Task: | Peli |
| Sender: | hltk |
| Submission time: | 2020-11-06 19:05: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:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&tc);
~~~~~^~~~~~~~~~
input/code.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",s);
~~~~~^~~~~~~~Code
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
using namespace std;
using pi = pair<int,int>;
using lint = long long;
const int MAXN = 105;
int n;
char s[MAXN];
int main(){
int tc;
scanf("%d",&tc);
while(tc--){
scanf("%s",s);
n = strlen(s);
int a = -1, b = -1;
for(int i=0; i<n; ++i){
if(s[i] == 'P'){
if(a == -1) a = i;
else b = i;
}
}
printf("%d\n", 2 - ((b - a - 1) & 1));
}
}
