AtCoder Beginner Contest 001

Submission #234172

Source codeソースコード

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] S = new int[N];
		int[] E = new int[N];
		for(int i=0;i<N;i++){
			String st = sc.next();
			S[i] = Integer.parseInt(st.substring(0, 4));
			S[i] = S[i] - (S[i]%5);
			E[i] = Integer.parseInt(st.substring(5, 9));
			if(E[i]%5 != 0){
				E[i] = E[i] + (5-(E[i]%5));
			}
		}
		int MAX = 12 * 24;
		boolean[] ansTime = new boolean[MAX];
		
		for(int i=0;i<N;i++){
			for(int j=getTimeID(S[i]);j<getTimeID(E[i]);j++){
				ansTime[j] = true;
			}
		}
		boolean flag = false;
		for(int i=0;i<MAX;i++){
			if(flag){
				if(ansTime[i]){
					continue;
				}else{
					System.out.print(String.format("%1$02d", (i/12)));
					System.out.println(String.format("%1$02d", (i%12*5)));
					flag=false;
				}
			}else{
				if(ansTime[i]){
					System.out.print(String.format("%1$02d", (i/12)));
					System.out.print(String.format("%1$02d", (i%12*5))+"-");
					flag=true;
				}else{
					continue;
				}
			}
		}
		if(flag) System.out.println(2400);
		sc.close();
	}

	static int getTimeID(int time){
		return (time/100)*12+((time%100)/5);
	}
}

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 ih_sk
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1241 Byte
File nameファイル名
Exec time実行時間 812 ms
Memory usageメモリ使用量 38852 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 388 ms 22720 KB
00_sample_02.txt AC 362 ms 22664 KB
00_sample_03.txt AC 363 ms 22664 KB
cho_cho_chokudai.txt AC 804 ms 37860 KB
chokudai_ga_cho.txt AC 802 ms 38444 KB
test_01.txt AC 452 ms 23528 KB
test_02.txt AC 468 ms 23700 KB
test_03.txt AC 451 ms 23732 KB
test_04.txt AC 450 ms 23632 KB
test_05.txt AC 451 ms 23664 KB
test_06.txt AC 414 ms 23768 KB
test_07.txt AC 392 ms 23332 KB
test_08.txt AC 396 ms 23540 KB
test_09.txt AC 440 ms 25212 KB
test_10.txt AC 436 ms 24464 KB
test_11.txt AC 446 ms 24032 KB
test_12.txt AC 433 ms 23524 KB
test_13.txt AC 390 ms 22708 KB
test_14.txt AC 455 ms 25084 KB
test_15.txt AC 447 ms 25040 KB
test_16.txt AC 380 ms 22836 KB
test_17.txt AC 422 ms 23604 KB
test_18.txt AC 391 ms 22816 KB
test_19.txt AC 420 ms 23588 KB
test_20.txt AC 424 ms 23580 KB
test_21.txt AC 771 ms 37132 KB
test_22.txt AC 775 ms 38056 KB
test_23.txt AC 777 ms 38112 KB
test_24.txt AC 786 ms 37404 KB
test_25.txt AC 784 ms 37368 KB
test_26.txt AC 782 ms 38384 KB
test_27.txt AC 765 ms 37188 KB
test_28.txt AC 805 ms 38852 KB
test_29.txt AC 367 ms 22584 KB
test_30.txt AC 393 ms 22732 KB
test_31.txt AC 563 ms 28284 KB
test_32.txt AC 379 ms 22652 KB
test_33.txt AC 724 ms 37240 KB
test_34.txt AC 371 ms 22684 KB
test_35.txt AC 401 ms 23308 KB
test_36.txt AC 785 ms 37984 KB
test_37.txt AC 737 ms 37304 KB
test_38.txt AC 731 ms 36684 KB
test_39.txt AC 807 ms 38504 KB
test_40.txt AC 812 ms 37948 KB
test_41.txt AC 804 ms 37844 KB
test_42.txt AC 748 ms 36760 KB
test_43.txt AC 785 ms 37596 KB