結果
問題 | No.70 睡眠の重要性! |
ユーザー |
![]() |
提出日時 | 2017-04-26 21:40:40 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 56 ms / 5,000 ms |
コード長 | 1,127 bytes |
コンパイル時間 | 5,353 ms |
コンパイル使用メモリ | 77,344 KB |
実行使用メモリ | 50,276 KB |
最終ジャッジ日時 | 2024-09-13 12:48:43 |
合計ジャッジ時間 | 3,212 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.time.format.DateTimeFormatter;import java.util.ArrayList;import java.util.Arrays;import java.util.List;public class Main {public static void main(String[] args) throws IOException {BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));int N = Integer.parseInt(reader.readLine());int sum = 0;for (int i = 0; i < N; i++) {String[] inputs = reader.readLine().split(" ");String[] sleepTime = inputs[0].split(":");String[] wakeUpTime = inputs[1].split(":");int H1 = Integer.parseInt(sleepTime[0]);int M1 = Integer.parseInt(sleepTime[1]);int h1 = Integer.parseInt(wakeUpTime[0]);int m1 = Integer.parseInt(wakeUpTime[1]);int a = H1 * 60 + M1;int b = h1 * 60 + m1;if (a > b) {sum +=b - a + 1440;} else {sum += b-a;}}System.out.println(sum);}}