프로그램 명: usa_slowdownB
제한시간: 1 초

[요약 ] 1 km 를 처음에는 초당 1 m 의 속력으로 가다 어떤 지점 혹은 시간 마다 초당 1/2 m , 1/3 m,... 로 속력을 줄여 간다.

전체 소요시간을 구하는 것이 문제이다.

소수 첫째 자리에서 반올림하여 정수자리만 표시한다. 사건은 동시에 발생할 수도 있고 이 경우 한 번만 적용하고 발생시간 순으로 입력되지 않는다.


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 (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).

입력

출력

* Line 1: The total time required for Bessie to travel 1 kilometer.

입출력 예

입력

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 980 * 3 = 2940 seconds. The total time is therefore 10 + 20 + 2940 = 2970.

출처:2014/jan/bronze

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]