結果

問題 No.70 睡眠の重要性!
ユーザー mustonmuston
提出日時 2016-06-01 13:13:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 3,288 ms
コンパイル使用メモリ 74,608 KB
実行使用メモリ 41,672 KB
最終ジャッジ日時 2024-04-16 22:22:25
合計ジャッジ時間 4,698 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,636 KB
testcase_01 AC 129 ms
41,672 KB
testcase_02 AC 133 ms
41,248 KB
testcase_03 AC 125 ms
40,116 KB
testcase_04 AC 134 ms
41,492 KB
testcase_05 AC 125 ms
41,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No70 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		//計測する日数
		int n =scan.nextInt();
		//寝た時間の合計
		int sum = 0;
		//寝た時間を計測
		for(int i=0;i<n;i++){
			String hi = scan.next();
			String ho = scan.next();
			String[] in = hi.split(":");
			String[] out = ho.split(":");
			int time1 = Integer.parseInt(in[0])*60+Integer.parseInt(in[1]);
			int time2 = Integer.parseInt(out[0])*60+Integer.parseInt(out[1]);
			if(time2-time1<0){
				time2 += 24*60;
			}
			sum += time2-time1;
		}
		//寝た時間の合計を出力
		System.out.println(sum);
	}
}
0