結果

問題 No.139 交差点
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2015-06-24 15:17:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 77,908 KB
実行使用メモリ 58,128 KB
最終ジャッジ日時 2023-09-22 00:29:47
合計ジャッジ時間 8,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,828 KB
testcase_01 AC 126 ms
55,456 KB
testcase_02 AC 127 ms
55,676 KB
testcase_03 AC 130 ms
55,900 KB
testcase_04 AC 137 ms
55,732 KB
testcase_05 AC 143 ms
55,716 KB
testcase_06 AC 130 ms
56,160 KB
testcase_07 AC 142 ms
55,976 KB
testcase_08 AC 138 ms
56,208 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 129 ms
55,972 KB
testcase_14 AC 143 ms
55,768 KB
testcase_15 WA -
testcase_16 AC 131 ms
55,904 KB
testcase_17 WA -
testcase_18 AC 144 ms
56,296 KB
testcase_19 AC 160 ms
56,048 KB
testcase_20 AC 137 ms
56,000 KB
testcase_21 AC 126 ms
55,916 KB
testcase_22 AC 126 ms
55,680 KB
testcase_23 AC 165 ms
56,012 KB
testcase_24 AC 127 ms
55,976 KB
testcase_25 WA -
testcase_26 AC 136 ms
55,944 KB
testcase_27 AC 133 ms
55,940 KB
testcase_28 AC 129 ms
55,680 KB
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
	}
}
0