結果

問題 No.70 睡眠の重要性!
ユーザー shinwisteriashinwisteria
提出日時 2018-03-04 15:39:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 801 bytes
コンパイル時間 4,029 ms
コンパイル使用メモリ 79,748 KB
実行使用メモリ 55,896 KB
最終ジャッジ日時 2023-09-22 03:06:25
合計ジャッジ時間 5,839 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
55,708 KB
testcase_01 AC 132 ms
55,896 KB
testcase_02 AC 141 ms
55,664 KB
testcase_03 AC 139 ms
55,776 KB
testcase_04 AC 137 ms
55,864 KB
testcase_05 AC 135 ms
55,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con70 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		String[] start = new String[N];
		String[] end = new String[N];
		 for(int i = 0;i < N;i++){
			 start[i] = s.next();
			 end[i] = s.next();
		 }
		 s.close();

		 int count = 0;
		 for(int i = 0;i < N;i++){
			 int a = Integer.parseInt(start[i].substring(0, start[i].indexOf(":"))) * 60 + Integer.parseInt(start[i].substring(start[i].indexOf(":") + 1,start[i].length()));
			 int b = Integer.parseInt(end[i].substring(0, end[i].indexOf(":"))) * 60 + Integer.parseInt(end[i].substring(end[i].indexOf(":") + 1,end[i].length()));
			 count += b-a;
			 if(a > b){
				 count += 24 * 60;
			 }
		 }
		 System.out.println(count);

	}

}
0