結果

問題 No.70 睡眠の重要性!
ユーザー GrenacheGrenache
提出日時 2015-09-23 00:24:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 220 ms / 5,000 ms
コード長 912 bytes
コンパイル時間 3,371 ms
コンパイル使用メモリ 72,812 KB
実行使用メモリ 56,792 KB
最終ジャッジ日時 2023-09-26 14:32:35
合計ジャッジ時間 5,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 208 ms
56,736 KB
testcase_01 AC 214 ms
56,784 KB
testcase_02 AC 220 ms
56,124 KB
testcase_03 AC 211 ms
56,792 KB
testcase_04 AC 200 ms
56,700 KB
testcase_05 AC 210 ms
56,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.SimpleDateFormat;
import java.util.Scanner;


public class Main_yukicoder70 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

		SimpleDateFormat sdf = new SimpleDateFormat("h:m");
		int n = sc.nextInt();
		int ret = 0;
		for (int i = 0; i < n; i++) {
			try {
				String ss = sc.next();
				String ee = sc.next();
//				System.err.println(ss);
//				System.err.println(ee);
//				System.err.println(sdf.parse(ss));
//				System.err.println(sdf.parse(ee));
				long s = sdf.parse(ss).getTime();
				long e = sdf.parse(ee).getTime();
//				System.err.println(s);
//				System.err.println(e);
				ret += (Math.abs((e - s + 3600 * 24 * 1000)) % (3600 * 24 * 1000)) / 60000;
			} catch (Exception exc) {
//				throw new RuntimeException();
				sc.close();
				return;
			}
		}
        
        System.out.println(ret);
        
        sc.close();
    }
}
0