結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-12-02 08:15:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 169 ms / 5,000 ms |
| コード長 | 707 bytes |
| コンパイル時間 | 3,102 ms |
| コンパイル使用メモリ | 83,544 KB |
| 実行使用メモリ | 54,468 KB |
| 最終ジャッジ日時 | 2024-09-13 03:50:39 |
| 合計ジャッジ時間 | 7,814 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int length = sc.nextInt();
int current = 0;
int time = 0;
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
int w = sc.nextInt();
int t = sc.nextInt();
time += x - current;
current = x;
if (time / t < (time + w - 1) / t || time / t % 2 == 1) {
time += 2 * t - time % (2 * t);
}
time += w;
current += w;
}
time += length - current;
System.out.println(time);
}
}
tenten