문제
Problem 2: Bessie Slows Down [Brian Dean, 2014]
Bessie the cow is competing in a cross-country skiing event at the winter Moolympic games. She starts out at a speed of 1 meter per second. However, as she becomes more tired over time, she begins to slow down. Each time Bessie slows down, her speed decreases: she moves at 1/2 meter per second after slowing down once, then 1/3 meter per second after slowing down twice, and so on.
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
PROBLEM NAME: slowdown
입력
* Line 1: The value of N.
* Lines
출력
* Line 1: The total time required for Bessie to travel 1 kilometer.
예제1
2
T 30
D 10
2970
INPUT DETAILS:
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