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$),计算她滑完一整千米所需秒数。将答案舍入到最近的整数秒(0.5 向上舍入为 1)。

输入格式

从标准输入读取输入。

  • 第 1 行:$N$。
  • 第 $2..1+N$ 行:每行形如 "$T$ $x$" 或 "$D$ $x$",表示时间或距离事件。两种情况下,$x$ 都是整数,保证事件发生在她滑完一千米之前。多个事件可以同时发生,使她一次减速多次。事件可能未按顺序给出。

输出格式

将输出写到标准输出。

  • 第 1 行:Bessie 滑完 1 千米所需的总时间。

样例

输入格式 1

2
T 30
D 10

输出格式 1

2970

说明

Bessie 在时刻 $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.