結果

問題 No.70 睡眠の重要性!
ユーザー SuunnSuunn
提出日時 2018-11-20 05:59:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 857 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 73,744 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-08-26 02:11:35
合計ジャッジ時間 3,531 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,796 KB
testcase_01 AC 122 ms
55,816 KB
testcase_02 AC 123 ms
55,756 KB
testcase_03 AC 129 ms
56,188 KB
testcase_04 AC 128 ms
55,812 KB
testcase_05 AC 124 ms
56,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
		
	}
}
0