Task: | Peli |
Sender: | TapaniS |
Submission time: | 2020-11-08 08:46:09 +0200 |
Language: | Java |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | ACCEPTED | 65 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.16 s | 1, 2 | details |
#2 | ACCEPTED | 0.17 s | 2 | details |
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(); } }