lightOJ 1227 - Boiled Eggs
来源:互联网 发布:怎么绑定域名到空间 编辑:程序博客网 时间:2024/04/29 17:27
贪心,一定要先sort一遍。。。。。。
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int arr[35];int main(){ std::ios::sync_with_stdio(false); int T,cas=0; cin >> T; while (T--) { int n,p,q,res=0,cnt=0; cin >> n >> p >> q; for (int i=0;i < n;i++) cin >> arr[i]; sort(arr,arr+n); for (int i = 0;i < n;i++) { res += arr[i]; if(cnt<p&&res<=q) cnt++; } printf ("Case %d: %d\n",++cas,cnt); } return 0;}
0 0
- lightOJ 1227 - Boiled Eggs
- light oj 1227 - Boiled Eggs
- UVa 11900 - Boiled Eggs
- Lightoj1227——Boiled Eggs(贪心)
- eggs
- Python Eggs
- Painting Eggs
- two eggs
- Eggs简介
- Drop Eggs
- Eggs Dropping puzzle(2 eggs, 100 floors)
- LightOJ
- LightOJ
- LightOJ
- LightOJ
- LightOJ
- [LightOJ
- LightOJ
- Android线性布局之layout_gravity和gravity区别
- 结构型模式
- Convolutional Networks
- JAVA学习总结思考
- 数据结构(Java)——查找和排序(3)
- lightOJ 1227 - Boiled Eggs
- eclipse无法连接到插入电脑上的手机
- 【甘道夫】HBase(0.96以上版本)过滤器Filter详解及实例代码
- MySql ibdata1文件瘦身
- 分拆素数和(http://acm.hdu.edu.cn/showproblem.php?pid=2098)
- ”在禁用UAC时,无法激活此应用“问题
- android shape的使用
- Android之Fragment简述
- 文字检测与识别1-MSER