結果
問題 | No.70 睡眠の重要性! |
ユーザー | kaoetaya |
提出日時 | 2016-11-09 15:47:02 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 120 ms / 5,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 2,875 ms |
コンパイル使用メモリ | 74,352 KB |
実行使用メモリ | 56,112 KB |
最終ジャッジ日時 | 2023-08-16 16:13:08 |
合計ジャッジ時間 | 4,240 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 105 ms
55,988 KB |
testcase_01 | AC | 107 ms
56,112 KB |
testcase_02 | AC | 109 ms
55,452 KB |
testcase_03 | AC | 115 ms
53,864 KB |
testcase_04 | AC | 120 ms
55,960 KB |
testcase_05 | AC | 107 ms
55,832 KB |
ソースコード
import java.util.Scanner; public class pre { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(),sum = 0,H,M,h,m; for(int i=0;i<n;i++){ String[] time = s.next().split(":"); H = Integer.parseInt(time[0]); M = Integer.parseInt(time[1]); time = s.next().split(":"); h = Integer.parseInt(time[0]); m = Integer.parseInt(time[1]); if(h==H && M>m){ sum = (60-M) + 23*60 + m+1; } else if(h==H && M<m){ sum = sum + (m - M); } else if((h - H) < 0){ sum = sum + (((24+h)*60+m) - (H*60+M)); } else{ sum = sum + ((h*60+m) - (H*60+M)); } } System.out.println(sum); } }