結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2018-04-21 20:46:25 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 5,000 ms |
| コード長 | 734 bytes |
| コンパイル時間 | 1,980 ms |
| コンパイル使用メモリ | 74,352 KB |
| 実行使用メモリ | 41,556 KB |
| 最終ジャッジ日時 | 2024-06-27 05:27:55 |
| 合計ジャッジ時間 | 3,289 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
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);
}
}
YamaKasa