結果

問題 No.70 睡眠の重要性!
ユーザー tentententen
提出日時 2020-11-10 15:15:27
言語 Java19
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 1,909 ms
コンパイル使用メモリ 71,700 KB
実行使用メモリ 56,552 KB
最終ジャッジ日時 2023-09-29 23:36:55
合計ジャッジ時間 3,370 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,456 KB
testcase_01 AC 122 ms
56,552 KB
testcase_02 AC 124 ms
56,088 KB
testcase_03 AC 129 ms
55,944 KB
testcase_04 AC 126 ms
55,748 KB
testcase_05 AC 121 ms
55,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = 0;
        for (int i = 0; i < n; i++) {
            int start = getTime(sc.next());
            int end = getTime(sc.next());
            ans += (end - start + 60 * 24) % (60 * 24);
        }
        System.out.println(ans);
    }
    
    static int getTime(String s) {
        String[] arr = s.split(":", 2);
        return Integer.parseInt(arr[0]) * 60 + Integer.parseInt(arr[1]);
    }
}
0