codeforces 417A Elimination
来源:互联网 发布:mysql时间毫秒 编辑:程序博客网 时间:2024/06/05 15:20
Description
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.
Input
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.
Output
In the first line, print a single integer — the minimum number of problems the jury needs to prepare.
Sample Input
Input
1 10
7 2
1
Output
2
Input
2 2
2 1
2
Output
0
题意:输入是c d n m k ;总决赛有n*m个名额,保送名额有k个,现在有两种形式的选拔赛,第一种需要出c道题,每办一场可以选出n支队伍,第二种每场有出d道题,每场选出一支队伍,问最少需要出多少题;
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;int main(){ int c,d,n,m,k; while(cin>>c>>d>>n>>m>>k) { int sum=n*m-k; if(sum<=0) { cout<<"0"<<endl; continue; } int num=0; int ch=sum/n; int s1=ch*c; int ch2=sum%n; int s2=ch*n*d; num=min(s2+min(ch2*d,c),s1+min(ch2*d,c)); cout<<num<<endl; } return 0;}
- codeforces 417A - Elimination
- codeforces 417A Elimination
- codeforces 417A A. Elimination
- Codeforces 417A Elimination(水题)
- codeforces Elimination
- Codeforces Bayan 2012-2013 Elimination Round / 241A Old Peykan (贪心)
- Codeforces 838A. Binary Blocks (区间筛+二维前缀和, IndiaHacks 2nd Elimination 2017 )
- Codeforces Round #434 (Div. 1, based on Technocup 2018 Elimination Round 1) A-C题解
- Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2) A-C题解
- Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination) A. Search for Pretty Integers
- Codeforces Round #454 (Div. 2, based on Technocup 2018 Elimination Round 4) A
- Codeforces Round #454 (Div. 2, based on Technocup 2018 Elimination Round 4) A-C
- Codeforces CROC 2016 - Elimination Round
- Codeforces Round #380 (Div. 2, Rated, Based on Technocup 2017 – Elimination Round 2) A. Interview wi
- Elimination
- HDU-4975-A simple Gaussian elimination problem.
- HDU4975 A simple Gaussian elimination problem.
- HDU -- 4975 A simple Gaussian elimination problem.
- mongdb及它的mapreduce的坑
- 设备驱动的艺术之旅 - 驱动和内核的关系
- 关于图像加密域检索的几种方法
- 0C-013.OC中的description方法
- Linux与windows之间-文件传输工具RZSZ
- codeforces 417A Elimination
- 杭电oj 1013
- 设备驱动的艺术之旅 - Watch Dog 的 NMI 应用场景
- js的浮点运算问题
- LCA tarjan 一类题目
- vtk 求线与多边形所在面的交点以及线与线的交点
- gd支持freetype扩展
- USACO 3.3 A Game游戏 (DP)
- 【比较】类图和对象图