結果

問題 No.70 睡眠の重要性!
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 22:38:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 856 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 71,764 KB
実行使用メモリ 57,924 KB
最終ジャッジ日時 2023-08-17 04:27:39
合計ジャッジ時間 3,550 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,588 KB
testcase_01 AC 124 ms
57,924 KB
testcase_02 AC 124 ms
56,016 KB
testcase_03 AC 127 ms
55,416 KB
testcase_04 AC 126 ms
55,636 KB
testcase_05 AC 123 ms
55,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int total =0;
        for(int i=0; i<N; i++){
            String S = sc.next();
            String [] arr1 = S.split(":");
            S = sc.next();
            String [] arr2 = S.split(":");
            int H = Integer.parseInt(arr1[0]);
            int M = Integer.parseInt(arr1[1]);
            int h = Integer.parseInt(arr2[0]);
            int m = Integer.parseInt(arr2[1]);
            int a = h-H;
            int b = m-M;
            if(b<0){
                a=a-1;
                b=b+60;
            }
            if(a<0){
                a = a +24;
            }
            int z = a*60+b;
            total = total + z;
        }
        System.out.println(total);
    }
}
0