Logo
(追記) (追記ここまで)

11275번 - iCar 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB30227.143%

문제

You are at home and about to drive to work. The road you will take is a straight line with no speed limit. There are, however, traffic lights precisely every kilometer, and you can not pass a red light. The lights change instantaneously between green and red, and you can pass a light whenever it is green. You can also pass through a light at the exact moment of changing colour. There are no traffic lights at the start or the end of the road.

Now your car is special; it is an iCar, the first Orange car, and it has only one button. When you hold down the button, the car accelerates at a constant rate of 1m/s2; when you release the button the car stops on the spot.

You have driven to work many times, so you happen to know the schedules of the traffic lights. Now the question is, how quickly can you get to work?

입력

The first line contains a single integer n, the length of the road in kilometers (1 ≤ n ≤ 16). Each of the next n − 1 lines contains 3 integers ti, gi and ri, the first time the i-th light will switch from red to green after the moment you start driving the car; the green light duration, and the red light duration (40 ≤ gi, ri ≤ 50; 0 ≤ ti < gi + ri). Times are given in seconds.

You may assume that any light with ti > ri is green at the time you start driving the car, and switches to red ti − ri seconds later.

출력

Output the minimum time required to reach the end of the road. Answers within a relative or absolute error of 10−6 will be accepted.

제한

예제 입력 1

1

예제 출력 1

44.72135955

예제 입력 2

2
50 45 45

예제 출력 2

68.52419365

예제 입력 3

2
25 45 45

예제 출력 3

63.2455532

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2015 I번

  • 문제를 만든 사람: Andreas Lundblad, Lukáš Poláček, Marc Vinyals
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /