結果

問題 No.139 交差点
ユーザー ciel
提出日時 2015-01-30 00:02:00
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 232 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-06-23 04:18:44
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - a
Main.rb:8: warning: assigned but unused variable - c
Syntax OK

ソースコード

diff #

N,L=gets.split.map(&:to_i)
curt=curd=0
N.times{
	x,w,t=gets.split.map(&:to_i)
	curt+=x-curd
	curd=x
	a,b=curt.divmod(2*t)
	c,d=(curt+w).divmod(2*t)
	curt=(curt+2*t-1)/(2*t)*(2*t) unless b<=t && d<=t
	curt+=w
	curd+=w
}
p L-curd+curt
0