結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  muston | 
| 提出日時 | 2016-06-01 13:13:14 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 141 ms / 5,000 ms | 
| コード長 | 667 bytes | 
| コンパイル時間 | 3,833 ms | 
| コンパイル使用メモリ | 79,528 KB | 
| 実行使用メモリ | 56,088 KB | 
| 最終ジャッジ日時 | 2024-10-08 03:46:38 | 
| 合計ジャッジ時間 | 4,854 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
import java.util.Scanner;
public class No70 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		//計測する日数
		int n =scan.nextInt();
		//寝た時間の合計
		int sum = 0;
		//寝た時間を計測
		for(int i=0;i<n;i++){
			String hi = scan.next();
			String ho = scan.next();
			String[] in = hi.split(":");
			String[] out = ho.split(":");
			int time1 = Integer.parseInt(in[0])*60+Integer.parseInt(in[1]);
			int time2 = Integer.parseInt(out[0])*60+Integer.parseInt(out[1]);
			if(time2-time1<0){
				time2 += 24*60;
			}
			sum += time2-time1;
		}
		//寝た時間の合計を出力
		System.out.println(sum);
	}
}
            
            
            
        