結果

問題 No.70 睡眠の重要性!
ユーザー uafr_csuafr_cs
提出日時 2016-02-02 19:16:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 748 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 57,092 KB
最終ジャッジ日時 2023-10-21 18:43:34
合計ジャッジ時間 3,751 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
57,092 KB
testcase_01 AC 140 ms
57,072 KB
testcase_02 AC 138 ms
57,008 KB
testcase_03 AC 144 ms
54,928 KB
testcase_04 AC 145 ms
57,080 KB
testcase_05 AC 138 ms
56,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	// やるだけ.
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		
		long sum = 0;
		for(int i = 0; i < N; i++){
			final String[] ins = sc.next().split(":");
			final String[] outs = sc.next().split(":");
			
			final int H = Integer.parseInt(ins[0]);
			final int M = Integer.parseInt(ins[1]);
			final int T = H * 60 + M;
			
			final int h = Integer.parseInt(outs[0]);
			final int m = Integer.parseInt(outs[1]);
			final int t = h * 60 + m;
			
			//System.out.println(T + " " + t);
			sum += (T >= t ? (24 * 60 - T + t) : (t - T));
		}
		
		System.out.println(sum);
	}
	
}
0