結果
問題 | No.70 睡眠の重要性! |
ユーザー | YamaKasa |
提出日時 | 2018-04-21 20:46:25 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 119 ms / 5,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 2,294 ms |
コンパイル使用メモリ | 71,880 KB |
実行使用メモリ | 55,752 KB |
最終ジャッジ日時 | 2023-09-09 12:23:11 |
合計ジャッジ時間 | 3,703 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 116 ms
55,648 KB |
testcase_01 | AC | 116 ms
55,624 KB |
testcase_02 | AC | 118 ms
55,748 KB |
testcase_03 | AC | 118 ms
55,752 KB |
testcase_04 | AC | 119 ms
55,640 KB |
testcase_05 | AC | 116 ms
55,444 KB |
ソースコード
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = Integer.parseInt(scan.nextLine()); String []s = new String[N]; for(int i = 0; i < N; i++) { s[i] = scan.nextLine(); } scan.close(); int ans = 0; for(int i = 0; i < N; i++) { String []str = s[i].split("[ :]"); int H = Integer.parseInt(str[0]); int M = Integer.parseInt(str[1]); int h = Integer.parseInt(str[2]); int m = Integer.parseInt(str[3]); int start = H * 60 + M; int end = h * 60 + m; int k = end -start; if(k < 0) { ans += 24 * 60 + k; }else if(k > 0) { ans += k; }else { ans += 24 * 60; } } System.out.println(ans); } }