Submission #1306101
Source Code Expand
import java.util.*; public class Main { public static void main(String args[]) { FastScanner cin = new FastScanner(); String s = cin.next(); int score = 0; for (int i = 0; i < s.length(); ++i) { if (s.charAt(i) == 'p') { if (i % 2 == 0) --score; } else { if (i % 2 == 1) ++score; } } System.out.println(score); } static class FastScanner { StringTokenizer tokenizer; Scanner scanner; FastScanner() { tokenizer = null; scanner = new Scanner(System.in); } int nextInt() { while (tokenizer == null || !tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(scanner.nextLine()); return Integer.parseInt(tokenizer.nextToken()); } String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(scanner.nextLine()); return tokenizer.nextToken(); } } }
Submission Info
Submission Time | |
---|---|
Task | A - AtCoDeer and Paint Cans |
User | pnnb |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1186 Byte |
Status | WA |
Exec Time | 103 ms |
Memory | 21332 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | WA | 91 ms | 19668 KB |
0_001.txt | WA | 89 ms | 20692 KB |
1_002.txt | WA | 92 ms | 20052 KB |
1_003.txt | AC | 96 ms | 18640 KB |
1_004.txt | WA | 103 ms | 21332 KB |
1_005.txt | WA | 92 ms | 19924 KB |