結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  kuramu | 
| 提出日時 | 2016-01-21 19:45:13 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 58 ms / 5,000 ms | 
| コード長 | 744 bytes | 
| コンパイル時間 | 2,097 ms | 
| コンパイル使用メモリ | 74,964 KB | 
| 実行使用メモリ | 50,328 KB | 
| 最終ジャッジ日時 | 2024-09-21 14:56:36 | 
| 合計ジャッジ時間 | 2,867 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(stdReader.readLine());
		int sum1 = 0;
		int sum2 = 0;
		int sum = 0;
		for(int i=0;i<n;i++){
			String[] temps = stdReader.readLine().split(" ");
			String[] time1 = temps[0].split(":");
			String[] time2 = temps[1].split(":");
			sum1 = Integer.parseInt(time1[0])*60+Integer.parseInt(time1[1]);
			sum2 = Integer.parseInt(time2[0])*60+Integer.parseInt(time2[1]);			
			if(sum2 - sum1 < 0)sum2+=24*60;
			sum += sum2-sum1;
		}
		System.out.println(sum);
	}
}
            
            
            
        