結果

問題 No.139 交差点
ユーザー kou6839kou6839
提出日時 2015-02-06 17:08:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 5,000 ms
コード長 603 bytes
コンパイル時間 3,655 ms
コンパイル使用メモリ 70,780 KB
実行使用メモリ 56,008 KB
最終ジャッジ日時 2023-09-05 14:31:07
合計ジャッジ時間 8,825 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,488 KB
testcase_01 AC 128 ms
55,660 KB
testcase_02 AC 127 ms
55,480 KB
testcase_03 AC 133 ms
53,320 KB
testcase_04 AC 140 ms
55,904 KB
testcase_05 AC 143 ms
55,520 KB
testcase_06 AC 133 ms
55,656 KB
testcase_07 AC 144 ms
55,708 KB
testcase_08 AC 138 ms
55,848 KB
testcase_09 AC 141 ms
55,484 KB
testcase_10 AC 153 ms
55,840 KB
testcase_11 AC 133 ms
55,708 KB
testcase_12 AC 159 ms
55,536 KB
testcase_13 AC 128 ms
55,768 KB
testcase_14 AC 142 ms
55,472 KB
testcase_15 AC 162 ms
55,832 KB
testcase_16 AC 132 ms
55,604 KB
testcase_17 AC 145 ms
55,828 KB
testcase_18 AC 142 ms
55,688 KB
testcase_19 AC 146 ms
55,704 KB
testcase_20 AC 135 ms
55,708 KB
testcase_21 AC 125 ms
56,008 KB
testcase_22 AC 125 ms
55,856 KB
testcase_23 AC 153 ms
55,708 KB
testcase_24 AC 128 ms
55,332 KB
testcase_25 AC 136 ms
55,600 KB
testcase_26 AC 135 ms
55,640 KB
testcase_27 AC 131 ms
55,560 KB
testcase_28 AC 127 ms
55,620 KB
testcase_29 AC 142 ms
55,708 KB
testcase_30 AC 143 ms
55,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nowt = 0;
        int nowl = 0;
        for(int i=0;i<n;i++){
        	int a =sc.nextInt();
        	int b =sc.nextInt();
        	int c = sc.nextInt();
        	nowt+=(a-nowl);
        	nowl=a+b;
        	if(nowt%(2*c) <= c-b){
        		nowt+=b;
        	}else{
        		nowt+=b+(2*c-nowt%(2*c));
        	}
        }
        System.out.println(l-nowl+nowt);
        
    }
}		
0