結果

問題 No.70 睡眠の重要性!
ユーザー FVRChanFVRChan
提出日時 2017-08-19 05:51:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 517 bytes
コンパイル時間 2,655 ms
コンパイル使用メモリ 75,080 KB
実行使用メモリ 41,376 KB
最終ジャッジ日時 2024-04-22 16:12:46
合計ジャッジ時間 3,552 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
40,132 KB
testcase_01 AC 126 ms
41,236 KB
testcase_02 AC 126 ms
41,028 KB
testcase_03 AC 131 ms
41,076 KB
testcase_04 AC 128 ms
41,376 KB
testcase_05 AC 129 ms
40,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine()),begin,end,sum=0;
		String s[];
		int are[]=new int[4];
		for(int i=0;i<n;i++){
			s=sc.nextLine().split(" |:");
			for(int j=0;j<4;j++)
				are[j]=Integer.parseInt(s[j]);
			if(are[0]>are[2] || (are[0]==are[2] && are[1]>are[3]))
				are[2]+=24;
			begin=are[0]*60+are[1];
			end=are[2]*60+are[3];
			sum+=(end-begin);
		}
		System.out.println(sum);
	}
}
0