Easy Problemset Gym100851E
来源:互联网 发布:win8能装ubuntu 编辑:程序博客网 时间:2024/06/04 18:36
**题意:**n 个裁判编号为1到n。每个裁判都准备了一定数量的难易程度为
选择的过程如下:
每次从一个裁判地方选一个,然后n个裁判轮着选,知道选够为止。
先从第一个裁判的问题列表中从前往后选一个(如果该裁判地方已经没有问题可选了直接选难度为50的题目),如果选中的问题难易程度大于等于已选所有问题的难易程度之和,则该问题被加入比赛,否则丢弃。
然后接着在下一个裁判的问题列表里选。
思路:这题只要弄明白题目意思,剩下的就只是模拟了。
代码:
#include<cstdio>#include<cstring>#include<cstdlib>#include<stack>#include<queue>#include<utility>#include<vector>#include<cmath>#include<set>#include<map>#include<iostream>#include<algorithm>using namespace std;typedef long long LL;int n, k;vector<int> vec[11]; //保存裁判们问题的难度系数int cnt[11]; //每个裁判准备的问题数目int pos[11]; //存第i个裁判的问题列表已经处理到哪个位置了int main(){ freopen("easy.in", "r", stdin); freopen("easy.out", "w", stdout); while(scanf("%d%d", &n, &k) == 2){ for(int i=0; i<11; i++){ vec[i].clear(); } memset(pos, 0, sizeof(pos)); for(int i=1; i<=n; i++){ scanf("%d", &cnt[i]); int tmp; for(int j=1; j<=cnt[i]; j++){ scanf("%d", &tmp); vec[i].push_back(tmp); } } int ans = 0; while(k > 0){ for(int i=1; i<=n; i++){ if(pos[i] < cnt[i]){ if(vec[i][pos[i]] >= ans){ ans += vec[i][pos[i]]; pos[i]++; k--; } else{ pos[i]++; } } else{ ans += 50; k--; } if(k == 0)break; } } printf("%d\n", ans); } return 0;}
阅读全文
0 0
- Easy Problemset Gym100851E
- UVALive-7470-Easy Problemset(模拟)
- 【模拟】NEERC15 E Easy Problemset (Codeforces GYM 100851)
- Codeforces Problemset 39A
- CS229 ProblemSet记录
- Codeforces ProblemSet 19B
- easy
- Easy
- http://codeforces.com/problemset/problem/4/A
- http://codeforces.com/problemset/problem/4/B
- http://codeforces.com/problemset/problem/4/C
- http://212.193.33.23/problemset/problem/154/A
- http://codeforces.com/problemset/problem/1/A
- http://codeforces.com/problemset/problem/228/A
- http://codeforces.com/problemset/problem/266/B
- http://codeforces.com/problemset/problem/236/A
- lightoj 1374 Confusion in the Problemset
- lightoj 1374 - Confusion in the Problemset 贪心
- 远程桌面到 Ubuntu 虚拟机
- 实用的Eclipse快捷键
- 【JAVA开发之架构专题】10.NIO通信架构
- ckeditor的简单使用以及多张图片上传插件的制作
- Just do it
- Easy Problemset Gym100851E
- 二叉树的最长路径和(Binary Tree Maximum Path Sum)
- 最小局域网实现tftp
- 错误信息:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
- excel数据导入导出的模块
- Linux-第五单元总结
- Android Fingerprint完全解析(三) :Fingerprint Hal层分析
- Android数据存储之SQLite
- c3p0参数解释