結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  kohaku_kohaku | 
| 提出日時 | 2016-11-13 22:38:15 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 116 ms / 5,000 ms | 
| コード長 | 856 bytes | 
| コンパイル時間 | 4,506 ms | 
| コンパイル使用メモリ | 84,072 KB | 
| 実行使用メモリ | 41,396 KB | 
| 最終ジャッジ日時 | 2024-11-25 22:04:20 | 
| 合計ジャッジ時間 | 3,306 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
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);
    }
}
            
            
            
        