結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
はまやんはまやん
|
| 提出日時 | 2015-06-24 15:17:59 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 736 bytes |
| コンパイル時間 | 1,769 ms |
| コンパイル使用メモリ | 76,792 KB |
| 実行使用メモリ | 41,940 KB |
| 最終ジャッジ日時 | 2024-07-07 17:24:34 |
| 合計ジャッジ時間 | 6,554 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 9 |
ソースコード
package coder;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
static int N, L;
static int[] X, W, T;
public static int solve(){
int t = 0;
int d = 0;
for (int i = 0; i < N; i++) {
t += X[i] - d;
d = X[i];
int tmp = (t + W[i] - 1) / T[i];
if(tmp % 2 == 1)
t = (tmp + 1) * T[i];
t += W[i];
d += W[i];
}
t += L - d;
System.out.println(t);
return 0;
}
public static void main(String[] args){
Scanner S = new Scanner(System.in);
N = S.nextInt();
L = S.nextInt();
X = new int[N];
W = new int[N];
T = new int[N];
for (int i = 0; i < N; i++) {
X[i] = S.nextInt();
W[i] = S.nextInt();
T[i] = S.nextInt();
}
solve();
}
}
はまやんはまやん