結果
問題 | No.70 睡眠の重要性! |
ユーザー |
![]() |
提出日時 | 2018-11-20 05:59:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 120 ms / 5,000 ms |
コード長 | 857 bytes |
コンパイル時間 | 2,336 ms |
コンパイル使用メモリ | 77,224 KB |
実行使用メモリ | 41,520 KB |
最終ジャッジ日時 | 2024-12-24 15:23:46 |
合計ジャッジ時間 | 3,422 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
import java.util.Scanner;public class Main{public static void main(String args[])throws Exception{Scanner sc = new Scanner(System.in);int N = sc.nextInt();int ans = 0;for(int i=0;i<N;i++){String A = sc.next();String B = sc.next();int basyoA = colon(A);int basyoB = colon(B);String HH = A.substring(0,basyoA);String MM = A.substring(basyoA+1);int H = Integer.parseInt(HH);int M = Integer.parseInt(MM);int timeA = H*60+M;String hh = B.substring(0,basyoB);String mm = B.substring(basyoB+1);int h = Integer.parseInt(hh);int m = Integer.parseInt(mm);int timeB = h*60+m+1440;ans += (timeB-timeA)%1440;}System.out.println(ans);}private static int colon(String a) {for(int i=0;i<a.length();i++){if(a.charAt(i) == ':'){return i;}}return 0;}}