Submission #1029201
Source Code Expand
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int ans = 0;
String n = scan.next();
String[] m = n.split("");
for(int i = 0; i < m.length; i++) {
if(m[i].equals("?")) {
if(i > 0 && i < m.length-1) {
if(m[i-1].equals("2")) {
m[i] = "5";
} else if(m[i+1].equals("5")) {
m[i] = "2";
}
} else if(i == 0) {
if(m[i+1].equals("5")) {
m[i] = "2";
}
} else if(i == m.length-1) {
if(m[i-1].equals("5")) {
m[i] = "5";
}
}
}
}
for(int i = 0; i < m.length; i++) {
if(m[i].equals("2")) {
if(i != m.length-1) {
if(m[i+1].equals("5")) {
ans += 2;
}
}
}
// System.out.println(m[i]);
}
System.out.println(ans);
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - ニコニコレベル |
| User | Tom1013 |
| Language | Java8 (OpenJDK 1.8.0) |
| Score | 0 |
| Code Size | 1247 Byte |
| Status | WA |
| Exec Time | 282 ms |
| Memory | 20424 KiB |
Judge Result
| Set Name | Sample | All | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, large_01.txt, large_02.txt, large_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand_01.txt | RE | 129 ms | 9680 KiB |
| hand_02.txt | WA | 122 ms | 9556 KiB |
| hand_03.txt | AC | 123 ms | 9680 KiB |
| hand_04.txt | WA | 122 ms | 9552 KiB |
| hand_05.txt | WA | 254 ms | 19444 KiB |
| large_01.txt | WA | 249 ms | 19456 KiB |
| large_02.txt | WA | 258 ms | 19840 KiB |
| large_03.txt | WA | 262 ms | 20092 KiB |
| random_01.txt | WA | 258 ms | 19876 KiB |
| random_02.txt | WA | 282 ms | 20372 KiB |
| random_03.txt | WA | 254 ms | 20424 KiB |
| random_04.txt | WA | 263 ms | 19632 KiB |
| sample_01.txt | AC | 122 ms | 9680 KiB |
| sample_02.txt | AC | 122 ms | 9552 KiB |
| sample_03.txt | AC | 123 ms | 9680 KiB |
| sample_04.txt | WA | 134 ms | 9548 KiB |
| sample_05.txt | AC | 120 ms | 9680 KiB |