結果

問題 No.70 睡眠の重要性!
ユーザー tenten
提出日時 2020-11-10 15:15:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 1,800 ms
コンパイル使用メモリ 75,252 KB
実行使用メモリ 41,432 KB
最終ジャッジ日時 2024-07-22 17:31:36
合計ジャッジ時間 3,068 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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