#63597. [USACO 2023 Feb Bronze]Watching Mooloo
[USACO 2023 Feb Bronze]Watching Mooloo
暂无测试数据。
英文题面
Bessie likes to watch shows on Mooloo. Because Bessie is a busy cow, she has planned a schedule for the next $N$ ($1 \leq N \leq 10^5$) days that she will watch Mooloo. Because Mooloo is a paid subscription service, she now needs to decide how to minimize the amount of money she needs to pay.
Mooloo has an interesting subscription system: it costs $d + K$($1\le K\le 10^9$) moonies to subscribe to Mooloo for $d$ consecutive days. You can start a subscription at any time, and you can start a new subscription as many times as you desire if your current subscription expires. Given this, figure out the minimum amount of moonies Bessie needs to pay to fulfill her schedule.
译文
贝西喜欢在 Mooloo 上看节目。因为贝西是一头很忙的牛,她已经为接下来的 $N(1 \leq N \leq 10^5)$ 天制定了一个时间表,她将看 Mooloo。因为 Mooloo 是付费订阅服务,所以她现在需要决定如何订阅,使得需要支付的金额降至最低。
Mooloo 有一个有趣的订阅系统:它需要花费 $d + K(1\le K\le 10^9$)元,连续订阅 $d$ 天。您可以在任何时候开始订阅,如果当前订阅到期,您可以任意多次开始新订阅。在此基础上,计算出贝茜为完成她的工作计划所需要支付的最少金额。
输入格式
The first line contains integers $N$ and $K$.
The second line contains $N$ integers describing the days Bessie will watch Mooloo: $1\le d_1 < d_2 < \dots < d_N\le 10^{14}$.
第一行包含整数 $N$ 和 $K$。
第二行包含 $N$ 整数,描述贝茜看 Mooloo 的日子:$1\le d_1 < d_2 < \dots < d_N\le 10^{14}$。
输出格式
Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).
注意,在这个问题中涉及的大量整数可能需要使用64位整数数据类型(例如,C/ c++中的“long long”)。
数据范围
- Inputs 3-5: $N\leq 10$
- Inputs 6-12: No additional constraints.
2 4
7 9
7
2 3
1 10
8