結果

問題 No.70 睡眠の重要性!
コンテスト
ユーザー kuramu
提出日時 2016-01-21 19:45:13
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 744 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,607 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 44,700 KB
最終ジャッジ日時 2026-04-09 20:09:39
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(stdReader.readLine());
		int sum1 = 0;
		int sum2 = 0;
		int sum = 0;
		for(int i=0;i<n;i++){
			String[] temps = stdReader.readLine().split(" ");
			String[] time1 = temps[0].split(":");
			String[] time2 = temps[1].split(":");
			sum1 = Integer.parseInt(time1[0])*60+Integer.parseInt(time1[1]);
			sum2 = Integer.parseInt(time2[0])*60+Integer.parseInt(time2[1]);			
			if(sum2 - sum1 < 0)sum2+=24*60;
			sum += sum2-sum1;
		}
		System.out.println(sum);
	}
}
0