結果
問題 | No.70 睡眠の重要性! |
ユーザー | kaoetaya |
提出日時 | 2016-11-09 15:47:02 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 125 ms / 5,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 3,716 ms |
コンパイル使用メモリ | 78,188 KB |
実行使用メモリ | 41,568 KB |
最終ジャッジ日時 | 2024-05-04 00:17:52 |
合計ジャッジ時間 | 4,234 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 125 ms
41,500 KB |
testcase_01 | AC | 125 ms
41,300 KB |
testcase_02 | AC | 108 ms
41,536 KB |
testcase_03 | AC | 117 ms
41,532 KB |
testcase_04 | AC | 122 ms
41,568 KB |
testcase_05 | AC | 117 ms
41,516 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); } }