Submission #185228
Source Code Expand
import java.io.IOException; import java.util.Scanner; class Main { /** * @param args */ public static void main(String[] args)throws IOException{ { Scanner Input = new Scanner(System.in); Boolean data[] = new Boolean[2401]; Boolean stat=false; int number = Input.nextInt(); //入力数 int start,end,begin=0; String s; for(int i=0;i<24;i++){ for(int j=0;j<=60;j++) data[i*100+j] = false; //0000から0059, 0100から0159〜 2300〜2359 for(int j=61;j<100;j++) data[i*100+j] = true; //0060から0099, 2300から2399 } data[2400] = false; for(int i=0;i<number;i++){ //入力個数だけ s = Input.next(); start = Integer.parseInt(s.substring(0,4)); end = Integer.parseInt(s.substring(5,9)); for(int k=start-start%5;end%5==0? k<=end:k<=end+(5-end%5);k++) data[k] = true; } for(int i=0;i<=2400;i++){ //System.out.println(i+" "+data[i]);//statがfalseは、雨降ってないゾーンにいたということ if(stat==false && data[i]==true && i%100<=60){ stat = true; begin = i; } else if(stat == true && data[i] ==false && i%100<=61){ System.out.printf("%04d-%04d\n",begin,i%100!=0?i-1:i); stat = false; } else if(stat == true && i==2400){ System.out.printf("%04d-%04d\n",begin,i); stat = false; } else{ //System.out.println(i +""+ stat +" " + data[i] + " " + i%100); } } //はじめから、連番になってるのをみつける。ただしその連番のスタートは下2桁が60未満 }} }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | nobuta1311 |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 1585 Byte |
Status | AC |
Exec Time | 968 ms |
Memory | 37768 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 403 ms | 22028 KB |
00_sample_02.txt | AC | 379 ms | 22064 KB |
00_sample_03.txt | AC | 378 ms | 21920 KB |
cho_cho_chokudai.txt | AC | 968 ms | 35756 KB |
chokudai_ga_cho.txt | AC | 744 ms | 35804 KB |
test_01.txt | AC | 416 ms | 22572 KB |
test_02.txt | AC | 418 ms | 22560 KB |
test_03.txt | AC | 419 ms | 22564 KB |
test_04.txt | AC | 416 ms | 22620 KB |
test_05.txt | AC | 419 ms | 22572 KB |
test_06.txt | AC | 407 ms | 23164 KB |
test_07.txt | AC | 390 ms | 23176 KB |
test_08.txt | AC | 385 ms | 22916 KB |
test_09.txt | AC | 440 ms | 23552 KB |
test_10.txt | AC | 431 ms | 23620 KB |
test_11.txt | AC | 425 ms | 23472 KB |
test_12.txt | AC | 414 ms | 23296 KB |
test_13.txt | AC | 393 ms | 23168 KB |
test_14.txt | AC | 436 ms | 23768 KB |
test_15.txt | AC | 441 ms | 23984 KB |
test_16.txt | AC | 392 ms | 22956 KB |
test_17.txt | AC | 435 ms | 23904 KB |
test_18.txt | AC | 407 ms | 23440 KB |
test_19.txt | AC | 411 ms | 23176 KB |
test_20.txt | AC | 428 ms | 24108 KB |
test_21.txt | AC | 652 ms | 34588 KB |
test_22.txt | AC | 693 ms | 35132 KB |
test_23.txt | AC | 664 ms | 34536 KB |
test_24.txt | AC | 708 ms | 34788 KB |
test_25.txt | AC | 680 ms | 34328 KB |
test_26.txt | AC | 661 ms | 35952 KB |
test_27.txt | AC | 649 ms | 33976 KB |
test_28.txt | AC | 685 ms | 36548 KB |
test_29.txt | AC | 369 ms | 22052 KB |
test_30.txt | AC | 377 ms | 22048 KB |
test_31.txt | AC | 549 ms | 28680 KB |
test_32.txt | AC | 374 ms | 22056 KB |
test_33.txt | AC | 637 ms | 35764 KB |
test_34.txt | AC | 374 ms | 22048 KB |
test_35.txt | AC | 399 ms | 22448 KB |
test_36.txt | AC | 724 ms | 35396 KB |
test_37.txt | AC | 717 ms | 37768 KB |
test_38.txt | AC | 673 ms | 36880 KB |
test_39.txt | AC | 672 ms | 35980 KB |
test_40.txt | AC | 661 ms | 35920 KB |
test_41.txt | AC | 816 ms | 35572 KB |
test_42.txt | AC | 808 ms | 35432 KB |
test_43.txt | AC | 774 ms | 35608 KB |