Codeforces 417A Elimination(水题)
来源:互联网 发布:迷糊娃娃淘宝价 编辑:程序博客网 时间:2024/06/15 01:26
题目链接:Codeforces 417A Elimination
题目大意:总决赛有n*m个名额,保送名额有k个,现在有两种形式的选拔赛,第一种需要出c道题,每办一场可以选出n支队伍,第二种每场有出d道题,每场选出一支队伍,问说委员会最少需要出多少到题。
解题思路:水题,首先总的需要n*m支队伍,已经保送k支队伍,用s=n*m-k就是还需要选出多少支队伍。
p = n * d(这样的话就等价了),t = s/n,t场比赛就选p和c中较小的即可。注意还有g =s%n,这部分要特殊考虑一下,是g*d,还是c。
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main () {int c, d, n, m, k;scanf("%d%d%d%d%d", &c, &d, &n, &m, &k);int s = n * m - k;int ans = 0;if (s <= 0) {ans = 0;} else {int p = d * n;int t = s / n;int g = s % n;ans = t * min(c, p) + min(g * d, c);}printf("%d\n", ans);return 0;}
0 0
- Codeforces 417A Elimination(水题)
- codeforces 417A - Elimination
- codeforces 417A Elimination
- codeforces 417A A. 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
- 8VC Venture Cup 2017 - Elimination Round A. PolandBall and Hypothesis【水题】
- HDU-4975-A simple Gaussian elimination problem.
- HDU4975 A simple Gaussian elimination problem.
- AsyncTask异步一
- The History of Email
- 长恨歌
- 第五章作业
- The Evolution of The Mobile PHone
- Codeforces 417A Elimination(水题)
- Source Insight 宏实现移动光标到行首或行尾
- Grails重定向以及Render、Session的使用
- 联想有着"万全"服务器产品线
- 主流开源协议比较
- ubuntu+opencv学习记录
- QT error Lnk112处理办法
- value的类型判断然后调用Date
- The World of Programming