提出詳細


ソースコード

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class LatenessChecker {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		File inFile = new File("A.txt");
		BufferedReader reader = null;
		FileReader fr = null;
		File outFile = new File("result.txt");
		BufferedWriter writer = null;
		FileWriter fw = null;
		try {
			// リーダ生成
			fr = new FileReader(inFile);
			reader = new BufferedReader(fr);
			// ライター生成
			fw = new FileWriter(outFile);
			writer = new BufferedWriter(fw);

			// テストケース数を読み込み
			int testCaseNum = Integer.parseInt(reader.readLine());

			// テストケース毎に計算、出力
			for (int i = 1; i <= testCaseNum; i++) {
				String caseNumStr = "Case #" + i + ":";

				String[] socStr = reader.readLine().split(" ");
				int[] soc = new int[3];
				for (int j = 0; j < 3; j++) {
					soc[j] = Integer.parseInt(socStr[j]);
				}

				Integer passageTime = soc[1] + soc[2];
				String result = soc[0] < passageTime ? "NG" : passageTime.toString();

				// 標準出力
				System.out.println(caseNumStr);
				System.out.println(result);

				// テキストファイルとして書き込み処理
				writer.write(caseNumStr);
				writer.newLine();
				writer.write(result);
				writer.newLine();
			}
			// テキストファイルをフラッシュ
			writer.flush();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			//各IOインスタンスのクローズ処理
			try {
				if (reader != null) reader.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				if (reader != null) writer.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				if (fr != null) fr.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				if (reader != null) fw.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}
}

提出情報

提出時間 2018-06-30 23:33:19
問題 A - 遅刻しがちな寺子さん
ユーザ名 soutarou1210
状態 正解
正解率 50/50
提出出力結果

テストケース情報

# 状態 詳細情報
テストケース 1 正解 詳細を見る
テストケース 2 正解 詳細を見る
テストケース 3 正解 詳細を見る
テストケース 4 正解 詳細を見る
テストケース 5 正解 詳細を見る
テストケース 6 正解 詳細を見る
テストケース 7 正解 詳細を見る
テストケース 8 正解 詳細を見る
テストケース 9 正解 詳細を見る
テストケース 10 正解 詳細を見る
テストケース 11 正解 詳細を見る
テストケース 12 正解 詳細を見る
テストケース 13 正解 詳細を見る
テストケース 14 正解 詳細を見る
テストケース 15 正解 詳細を見る
テストケース 16 正解 詳細を見る
テストケース 17 正解 詳細を見る
テストケース 18 正解 詳細を見る
テストケース 19 正解 詳細を見る
テストケース 20 正解 詳細を見る
テストケース 21 正解 詳細を見る
テストケース 22 正解 詳細を見る
テストケース 23 正解 詳細を見る
テストケース 24 正解 詳細を見る
テストケース 25 正解 詳細を見る
テストケース 26 正解 詳細を見る
テストケース 27 正解 詳細を見る
テストケース 28 正解 詳細を見る
テストケース 29 正解 詳細を見る
テストケース 30 正解 詳細を見る
テストケース 31 正解 詳細を見る
テストケース 32 正解 詳細を見る
テストケース 33 正解 詳細を見る
テストケース 34 正解 詳細を見る
テストケース 35 正解 詳細を見る
テストケース 36 正解 詳細を見る
テストケース 37 正解 詳細を見る
テストケース 38 正解 詳細を見る
テストケース 39 正解 詳細を見る
テストケース 40 正解 詳細を見る
テストケース 41 正解 詳細を見る
テストケース 42 正解 詳細を見る
テストケース 43 正解 詳細を見る
テストケース 44 正解 詳細を見る
テストケース 45 正解 詳細を見る
テストケース 46 正解 詳細を見る
テストケース 47 正解 詳細を見る
テストケース 48 正解 詳細を見る
テストケース 49 正解 詳細を見る
テストケース 50 正解 詳細を見る