QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21066. Bessie가 느려진다

Statistics

Bessie는 겨울 Moolympic의 크로스컨트리 스키에 참가합니다. 처음 속도는 초당 1미터지만 시간이 지나 지쳐 느려집니다. 감속마다 속도가 줄어 첫 번째 후 초당 $1/2$미터, 두 번째 후 초당 $1/3$미터가 되며 계속 같은 식입니다.

언제 어디서 감속하는지 사건으로 주어집니다. 다음 사건:

T 17

은 특정 시각, 여기서는 시작 17초 후의 감속입니다. 다음 사건:

D 10

은 출발점으로부터 특정 거리, 여기서는 10미터에서의 감속입니다.

$N$개의 사건($1 \leq N \leq 10,000$)으로 1킬로미터 전체를 가는 데 필요한 초를 구하세요. 가장 가까운 정수 초로 반올림하세요(0.5는 1로 올림).

입력

표준 입력에서 읽으세요.

  • 1번 줄: $N$.
  • $2..1+N$번 줄: 각 줄은 "$T$ $x$" 또는 "$D$ $x$"로 시간 또는 거리 사건입니다. 두 경우 모두 $x$는 정수이며 1킬로미터에 도달하기 전 사건임이 보장됩니다. 여러 사건이 동시에 발생하여 한 번에 크게 느려질 수 있습니다. 순서대로 나열되지 않을 수 있습니다.

출력

표준 출력에 쓰세요.

  • 1번 줄: 1킬로미터를 가는 총시간.

예제

입력 1

2
T 30
D 10

출력 1

2970

참고

$t = 30$과 $d = 10$에서 감속합니다.

처음 10미터는 초당 1미터로 10초 걸립니다. $1/2$로 감속하여 다음 10미터는 20초 걸립니다. 30초가 되면 $1/3$로 감속합니다. 남은 980미터는 $980 * 3 = 2940$초 걸립니다. 총시간은 $10 + 20 + 2940 = 2970$입니다.

문제 작성자: Brian Dean, 2014

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.