Submission #1030791
Source Code Expand
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Solver().run();
}
}
class Solver{
private Scanner sc;
public void run(){
sc = new Scanner(System.in);
String T = sc.next();
int result = 0;
result = searchStr(T, "25");
System.out.println(result);
}
private int searchStr(String T, String str) {
int cnt = 0;
int Tsize = T.length();
boolean flg = false;
int csl = 0;
int result = 0;
for(int i=0; i<Tsize-1; i++){
if(T.charAt(i) == str.charAt(0)){
if(T.charAt(i+1)==str.charAt(1) || T.charAt(i+1)== '?'){
if(!flg){
csl = i;
flg = true;
}
cnt+=2;
i++;
continue;
}
}else if(T.charAt(i) == '?'){
if(T.charAt(i+1)=='?' || T.charAt(i+1)==str.charAt(1)){
if(!flg){
csl = i;
flg = true;
}
cnt+=2;
i++;
continue;
}else{
if(result < cnt) result=cnt;
cnt = 0;
if(flg){
i = csl;
flg = false;
}
else csl = i;
}
}else{
if(result < cnt) result=cnt;
cnt = 0;
if(flg){
i = csl;
flg = false;
}
else csl = i;
}
}
if(result < cnt) result=cnt;
return result;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - ニコニコレベル |
| User | kzo_009 |
| Language | Java7 (OpenJDK 1.7.0) |
| Score | 0 |
| Code Size | 1297 Byte |
| Status | WA |
| Exec Time | 2656 ms |
| Memory | 13244 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 | AC | 124 ms | 8916 KiB |
| hand_02.txt | AC | 125 ms | 8916 KiB |
| hand_03.txt | AC | 123 ms | 8916 KiB |
| hand_04.txt | AC | 126 ms | 8916 KiB |
| hand_05.txt | AC | 214 ms | 12516 KiB |
| large_01.txt | WA | 254 ms | 12404 KiB |
| large_02.txt | AC | 536 ms | 13244 KiB |
| large_03.txt | TLE | 2656 ms | 12612 KiB |
| random_01.txt | WA | 231 ms | 12496 KiB |
| random_02.txt | AC | 230 ms | 12620 KiB |
| random_03.txt | AC | 221 ms | 12496 KiB |
| random_04.txt | WA | 208 ms | 12760 KiB |
| sample_01.txt | AC | 124 ms | 8916 KiB |
| sample_02.txt | AC | 124 ms | 8916 KiB |
| sample_03.txt | AC | 126 ms | 8916 KiB |
| sample_04.txt | AC | 124 ms | 8916 KiB |
| sample_05.txt | AC | 125 ms | 8916 KiB |