結果

問題 No.70 睡眠の重要性!
ユーザー kuramukuramu
提出日時 2016-01-21 19:45:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 744 bytes
コンパイル時間 2,462 ms
コンパイル使用メモリ 74,796 KB
実行使用メモリ 53,508 KB
最終ジャッジ日時 2023-10-21 13:42:04
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
53,496 KB
testcase_01 AC 61 ms
53,508 KB
testcase_02 AC 61 ms
52,444 KB
testcase_03 AC 58 ms
52,404 KB
testcase_04 AC 62 ms
53,500 KB
testcase_05 AC 60 ms
52,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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