CodeForces - 417A(思维题)
来源:互联网 发布:舞蹈培训网络推广方案 编辑:程序博客网 时间:2024/06/07 13:46
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
1 10
7 2
1
2
2 2
2 1
2
0
Source
#include <iostream>#include <stdio.h>#include <stdlib.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;int a[200010]; main(){ int c,d,n,m,k; cin>>c>>d>>n>>m>>k; int tem=n*m-k; if(tem<=0){cout<<0<<endl;} else { if((double)c/(double)n<(double)d) { int t=tem/n,sheng=tem-t*n,hh=sheng*d; if(hh<c) cout<<c*t+hh<<endl; else cout<<c*t+c<<endl; }else cout<<tem*d<<endl; } return 0;}
- CodeForces - 417A(思维题)
- Codeforces 424A (思维题)
- CodeForces 714A 思维题 C
- codeforces 754A(思维题)
- 【codeforces】A. Array(思维水题)
- codeforces-754【A思维】
- CodeForces - 417B (思维题)
- Codeforces-298A 思维训练
- Codeforces-297A 思维训练
- CodeForces 359A - Table(思维)
- codeforces 856A (思维)
- Codeforces Round #353 (Div. 2) A. Infinite Sequence 思维题
- CodeForces - 427A (警察和罪犯 思维题)
- Codeforces Round #337 (Div. 2) A-----思维题
- codeforces 764C Timofey and a tree (思维题)
- Codeforces Round #411 A.Fake NP (思维题)
- 【codeforces】A. The Text Splitting(思维题-水题)
- CodeForces 305A Strange Addition(思维题)
- CodeForces - 405C
- CodeForces - 407A
- CodeForces - 407B
- CodeForces - 416A (判断大于小于等于 模拟题)
- 深度学习FPGA实现基础知识15(Matlab图像处理“卷积”运算)
- CodeForces - 417A(思维题)
- CodeForces - 417B (思维题)
- CodeForces - 417E(随机数)
- CodeForces - 420A (字符对称问题)
- php多进程学习
- 辗转相除法的证明
- Codeforces 424A (思维题)
- CodeForces - 424B (贪心算法)
- 算法的重要性