[요약 ] 1 km 를 처음에는 초당 1 m 의 속력으로 가다 어떤 지점 혹은 시간 마다 초당 1/2 m , 1/3 m,... 로 속력을 줄여 간다.
소수 첫째 자리에서 반올림하여 정수자리만 표시한다. 사건은 동시에 발생할 수도 있고 이 경우 한 번만 적용하고 발생시간 순으로 입력되지 않는다.
You are told when and where Bessie slows down, in terms of a series of events.
An event like this:
T 17
means that Bessie slows down at a specific time -- here, 17 seconds into the race.
An event like this:
D 10
means that Bessie slows down at a specific distance from the start -- in this case, 10 meters.
Given a list of N such events (1 <= N <= 10,000), please compute the amount of time, in seconds, for Bessie to travel an entire kilometer. Round your answer to the nearest integer second (0.5 rounds up to 1).
입력 2 T 30 D 10 출력 2970
Bessie slows down at time t = 30 and at distance d = 10.
OUTPUT DETAILS:
Bessie travels the first 10 meters at 1 meter/second, taking 10 seconds. She then slows down to 1/2 meter/second, taking 20 seconds to travel the next 10 meters. She then reaches the 30 second mark, where she slows down again to 1/3 meter/second. The remaining 980 meters therefore take her 980 * 3 = 2940 seconds. The total time is therefore 10 + 20 + 2940 = 2970.
출처:2014/jan/bronze