AtCoder Beginner Contest 001

Submission #110380

Source codeソースコード

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
 
 
public class Main {
	private static  BufferedReader  br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	* @param args
	*/
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String		out = "";
		boolean[]	res = new boolean[290];
		boolean		chk = false;
		int			cnt = parseCnt();
		int			min = 288;
		int			max = 0;

		for (int i = 0; i < cnt; i++) {
			int[]	rng = parseRange();

			min = (min > rng[0]) ? rng[0] : min;
			max = (max < rng[1]) ? rng[1] : max;

			Arrays.fill(res, rng[0], rng[1], true);
		}

		for (int i = min; i < max+1; i++) {
			if (!chk && res[i]) {
				out = String.format("%04d-", ((i*5)/60)*100+((i*5)%60));
				chk = true;
			} else if (chk && !res[i]) {
				out += String.format("%04d", ((i*5)/60)*100+((i*5)%60));
				System.out.println(out);
				out = "";
				chk = false;
			}
		}
	}

	private static int[] parseRange() {
		int[]	rng = null;
		String  str = null;

		if ((str = parseStdin()) != null) {
			String[]	line = str.split("-");
			int			tmp1 = Integer.parseInt(line[0]);
			int			tmp2 = Integer.parseInt(line[1]);

			tmp1 = (tmp1 / 100) * 60 + tmp1 % 100;
			tmp2 = (tmp2 / 100) * 60 + tmp2 % 100;

			rng = new int[2];
			rng[0] = tmp1 / 5;
			rng[1] = tmp2 / 5 + ((tmp2 % 5 > 0) ? 1 : 0);
		}

		return rng;
	}

	private static int parseCnt() {
		int     cnt = 0;
		String  str = null;

		if ((str = parseStdin()) != null) {
			cnt = Integer.parseInt(str);
		}

		return cnt;
	}

	private static String parseStdin() {
		String	stdin = null;

		try {
			String	tmp = br.readLine();
			if (tmp != null) {
				if (!tmp.isEmpty()) stdin = tmp;
				}
			}
		catch (IOException e) {}

		return stdin;
	}
}

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 あらまき
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1925 Byte
File nameファイル名
Exec time実行時間 754 ms
Memory usageメモリ使用量 34320 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 435 ms 21196 KB
00_sample_02.txt AC 408 ms 21084 KB
00_sample_03.txt AC 416 ms 21204 KB
cho_cho_chokudai.txt AC 628 ms 33380 KB
chokudai_ga_cho.txt AC 635 ms 31804 KB
test_01.txt AC 438 ms 22364 KB
test_02.txt AC 442 ms 22336 KB
test_03.txt AC 420 ms 22232 KB
test_04.txt AC 450 ms 22364 KB
test_05.txt AC 468 ms 22360 KB
test_06.txt AC 458 ms 21836 KB
test_07.txt AC 438 ms 21848 KB
test_08.txt AC 441 ms 21852 KB
test_09.txt AC 453 ms 22104 KB
test_10.txt AC 460 ms 22356 KB
test_11.txt AC 428 ms 22360 KB
test_12.txt AC 420 ms 22240 KB
test_13.txt AC 418 ms 21208 KB
test_14.txt AC 421 ms 22236 KB
test_15.txt AC 424 ms 22372 KB
test_16.txt AC 408 ms 21212 KB
test_17.txt AC 428 ms 22232 KB
test_18.txt AC 412 ms 21228 KB
test_19.txt AC 426 ms 22240 KB
test_20.txt AC 425 ms 21980 KB
test_21.txt AC 627 ms 33188 KB
test_22.txt AC 630 ms 33772 KB
test_23.txt AC 621 ms 32128 KB
test_24.txt AC 644 ms 33192 KB
test_25.txt AC 628 ms 32124 KB
test_26.txt AC 668 ms 32852 KB
test_27.txt AC 631 ms 33080 KB
test_28.txt AC 674 ms 32236 KB
test_29.txt AC 411 ms 21212 KB
test_30.txt AC 410 ms 21208 KB
test_31.txt AC 505 ms 26548 KB
test_32.txt AC 413 ms 21212 KB
test_33.txt AC 629 ms 34272 KB
test_34.txt AC 409 ms 21208 KB
test_35.txt AC 418 ms 21344 KB
test_36.txt AC 623 ms 32876 KB
test_37.txt AC 644 ms 33900 KB
test_38.txt AC 660 ms 34320 KB
test_39.txt AC 633 ms 34256 KB
test_40.txt AC 647 ms 34208 KB
test_41.txt AC 754 ms 33088 KB
test_42.txt AC 623 ms 32208 KB
test_43.txt AC 611 ms 31756 KB