QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100

#3960. F1 赛车

统计

在整个欧洲,随着 NextFlex 发布了《Cars go vrooooom》,F1 热潮比以往任何时候都更加高涨。一旦你沉浸其中,就无法自拔。戏剧性、战术、比赛,最重要的是戏剧性。

今年的系列赛是迄今为止最令人兴奋的比赛之一。两位主要明星 Min Verstopen 和 Lery Slowington 之间的传奇对决总是让比赛充满娱乐性。一路走来,充满了心理博弈、激烈的交锋和几乎发生的事故。但最重要的是,F1 比赛的获胜者是速度最快的车手,以及拥有最佳战术决策的车队。

一位非常投入的粉丝 Dorothy 注意到,在现代 F1 时代,F1 赛车上有许多仪器,为车队提供关于赛车在不同条件下行驶速度的数据。Dorothy 认为,人们可以利用卓越的算法知识,在给定一组比赛条件的情况下决定最佳的战术。她进行了一些统计,发现一辆使用 $x$ 圈旧轮胎的赛车,跑完一圈需要:

$$r + b \cdot x$$

秒,其中 $r$ 和 $b$ 是取决于特定赛道的常数。现在她求助于你,希望你能提供一个算法,为车队找出在最优进站策略下的总比赛时间。

CC-BY-2.0, Honda Pit Stop by ariffjamili via Flickr

输入格式

输入包含四个用空格分隔的整数 $n, p, r$ 和 $b$。

  • $1 \le n \le 10^9$ 表示比赛的圈数,
  • $0 \le p \le 10^9$ 表示更换轮胎所需的时间(以秒为单位),
  • $1 \le r \le 100$ 表示使用新轮胎跑完一圈所需的时间(以秒为单位),
  • $0 \le b \le 4$ 表示轮胎的磨损系数。

输出格式

一个整数,表示完成比赛所需的最少秒数。

样例

样例输入 1

10 10 100 2

样例输出 1

1044

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.