AtCoder Beginner Contest 001

Submission #1228703

Source codeソースコード

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = Integer.parseInt(scan.next());

		String s;
		int start;
		int end;
		int[] rain = new int[12*24+1];

		int S[] = new int[2];
		int index;

		for(int i=0;i<N;i++){
			s = scan.next();
			start = Integer.parseInt(s.substring(0,4))+1000;
			end = Integer.parseInt(s.substring(5,9))+1000;

			start -=start%5;
			end +=(5-end%5)%5;
			if(end%100 == 60){
				end+=40;
			}

			S[0]=start/100 -10;//S=時間
			S[1]=(start%100)/5;
			index = S[0]*12+S[1];
			rain[index] += 1;

			S[0]=end/100 -10;//S=時間
			S[1]=(end%100)/5;
			index = S[0]*12+S[1];
			rain[index] -= 1;

		}

		int sum=0;
		for(int i=0;i<24*12+1;i++){
			sum+=rain[i];
			rain[i]=sum;
		}



		boolean rainy=false;
		for(int i=0;i<24*12+1;i++){

			if(!rainy&&rain[i]>0){
				System.out.print(String.format("%04d", (i/12)*100+(i%12)*5));
				rainy = true;
			}
			if(rainy&&rain[i]==0){
				System.out.println("-"+String.format("%04d", (i/12)*100+(i%12)*5));
				rainy = false;
			}

		}


	}

}

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 016_inmir
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1227 Byte
File nameファイル名
Exec time実行時間 269 ms
Memory usageメモリ使用量 41136 KB

Test case

Set

Set name Score得点 / Max score Cases
all 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 90 ms 19924 KB
00_sample_02.txt AC 91 ms 19540 KB
00_sample_03.txt AC 89 ms 21844 KB
cho_cho_chokudai.txt AC 246 ms 40584 KB
chokudai_ga_cho.txt AC 247 ms 38992 KB
test_01.txt AC 128 ms 20308 KB
test_02.txt AC 124 ms 22996 KB
test_03.txt AC 126 ms 20692 KB
test_04.txt AC 127 ms 20692 KB
test_05.txt AC 126 ms 22740 KB
test_06.txt AC 105 ms 19412 KB
test_07.txt AC 108 ms 19540 KB
test_08.txt AC 99 ms 21588 KB
test_09.txt AC 119 ms 19412 KB
test_10.txt AC 124 ms 21204 KB
test_11.txt AC 108 ms 21076 KB
test_12.txt AC 112 ms 23892 KB
test_13.txt AC 100 ms 21972 KB
test_14.txt AC 113 ms 22356 KB
test_15.txt AC 116 ms 21452 KB
test_16.txt AC 100 ms 18772 KB
test_17.txt AC 110 ms 21588 KB
test_18.txt AC 103 ms 20052 KB
test_19.txt AC 106 ms 22100 KB
test_20.txt AC 113 ms 20436 KB
test_21.txt AC 269 ms 39596 KB
test_22.txt AC 243 ms 40496 KB
test_23.txt AC 262 ms 40484 KB
test_24.txt AC 250 ms 41084 KB
test_25.txt AC 254 ms 40396 KB
test_26.txt AC 249 ms 41072 KB
test_27.txt AC 246 ms 38708 KB
test_28.txt AC 260 ms 40460 KB
test_29.txt AC 91 ms 19924 KB
test_30.txt AC 109 ms 18768 KB
test_31.txt AC 160 ms 26208 KB
test_32.txt AC 96 ms 19156 KB
test_33.txt AC 218 ms 33856 KB
test_34.txt AC 92 ms 21716 KB
test_35.txt AC 114 ms 21204 KB
test_36.txt AC 248 ms 39152 KB
test_37.txt AC 261 ms 40156 KB
test_38.txt AC 252 ms 37772 KB
test_39.txt AC 251 ms 41020 KB
test_40.txt AC 260 ms 38532 KB
test_41.txt AC 250 ms 41136 KB
test_42.txt AC 256 ms 39292 KB
test_43.txt AC 260 ms 39948 KB