結果

問題 No.70 睡眠の重要性!
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 09:49:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 148 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 85,760 KB
実行使用メモリ 54,848 KB
最終ジャッジ日時 2024-05-01 09:11:23
合計ジャッジ時間 3,703 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
54,756 KB
testcase_01 AC 148 ms
54,736 KB
testcase_02 AC 130 ms
54,240 KB
testcase_03 AC 142 ms
54,848 KB
testcase_04 AC 138 ms
54,616 KB
testcase_05 AC 134 ms
54,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		for(int i = 0 ; i < n ; i++) {
			String[] temp = (sc.next() + ":" + sc.next()).split("[\\:]");
			int[] time = {Integer.valueOf(temp[0]), Integer.valueOf(temp[1])
					    , Integer.valueOf(temp[2]), Integer.valueOf(temp[3])};
			int st = time[0] * 60 + time[1];
			int en = time[2] * 60 + time[3];
			if(st > en) en += 24 * 60;
			ans += en - st;
		}
		System.out.println(ans);
 	}
}

0