CF417A.Elimination

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.

The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the winners of the round are the first n people in the rating list. Each of the additional elimination rounds consists of d problems. The winner of the additional round is one person. Besides, k winners of the past finals are invited to the finals without elimination.

As a result of all elimination rounds at least n·m people should go to the finals. You need to organize elimination rounds in such a way, that at least n·m people go to the finals, and the total amount of used problems in all rounds is as small as possible.

“俄罗斯编程杯”(Russian Code Cup)比赛 2214 年度的决赛选手,为在某一轮淘汰赛中获胜的参赛者。

淘汰赛分为主淘汰赛和附加淘汰赛两类。每场主淘汰赛包含 cc 道题目,该轮的获胜者为排行榜上前 nn 名的选手;每场附加淘汰赛包含 dd 道题目,该轮仅有一名获胜者。此外,过往决赛的 kk 名获胜者将无需参加淘汰赛,直接获得决赛资格。

所有淘汰赛结束后,进入决赛的总人数应至少为 n⋅mn \cdot m 人。你需要合理安排淘汰赛的场次(即确定主淘汰赛场数与附加淘汰赛场数),使得最终进入决赛的人数不少于 n⋅mn \cdot m,且所有淘汰赛所使用的题目总数尽可能少。

输入格式

The first line contains two integers c and d (1 ≤ c, d ≤ 100) — the number of problems in the main and additional rounds, correspondingly. The second line contains two integers n and m (1 ≤ n, m ≤ 100). Finally, the third line contains an integer k (1 ≤ k ≤ 100) — the number of the pre-chosen winners.

第一行包含两个整数 cc 和 dd(1≤c,d≤1001 \leq c, d \leq 100)—— 分别表示主轮和附加轮的问题数量。
第二行包含两个整数 nn 和 mm(1≤n,m≤1001 \leq n, m \leq 100)。
最后,第三行包含一个整数 kk(1≤k≤1001 \leq k \leq 100)—— 表示预先选定的获胜者编号。

输出格式

In the first line, print a single integer — the minimum number of problems the jury needs to prepare.

在第一行,输出一个整数——评测组需要准备的最少题目数量。

输入输出样例

  • 输入#1

    1 10
    7 2
    1

    输出#1

    2
  • 输入#2

    2 2
    2 1
    2

    输出#2

    0

输入解题思路,AI测评打分。不知道怎么写?

首页