CSES - Putka Open 2020 – 4/5 - Results
Submission details
Task:Peli
Sender:TapaniS
Submission time:2020-11-08 08:46:09 +0200
Language:Java
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.16 s1, 2details
#2ACCEPTED0.17 s2details

Code

import java.util.*;
public class peli {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//int t = input.nextInt();
int t = Integer.parseInt(input.nextLine());
int ind1 = 0;
int ind2 = 0;
int ans = 0;
for (int i = 0; i < t; i++) {
String abc = input.nextLine();
ind1 = abc.indexOf("P");
abc = abc.replaceFirst("P",".");
ind2 = abc.indexOf("P");
ans = ((ind2 - ind1) % 2) + 1;
System.out.println(ans);
}
input.close();
}
}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
100
PP.
P......P.
.PP
..P.P.
...

correct output
2
2
2
1
2
...

user output
2
2
2
1
2
...
Truncated

Test 2

Group: 2

Verdict: ACCEPTED

input
100
.................................

correct output
2
1
2
1
1
...

user output
2
1
2
1
1
...
Truncated