POJ_3627 Bookshelf
来源:互联网 发布:淘宝复制链接在哪打开 编辑:程序博客网 时间:2024/06/16 00:18
思路: 排序+贪心,,,
# include<cstdio># include<iostream># include<algorithm>using namespace std;int cow[20010];int main(void){ int n;cin>>n; int b;cin>>b; for ( int i = 0;i < n;i++ ) { cin>>cow[i]; } sort(cow,cow+n); int sum = 0; int i = n; while ( sum < b ) { i--; sum+=cow[i]; } cout<<n-i<<endl; return 0;}
0 0
- POJ_3627 Bookshelf
- bookshelf
- Bookshelf
- Bookshelf 2
- Bookshelf 2
- 书架Bookshelf
- Pragmatic.Bookshelf.Rails.Recipes
- poj 3627 Bookshelf
- POJ3628 Bookshelf 2
- POJ 3628 - Bookshelf 2
- POJ 3628 - Bookshelf 2
- POJ 3628 Bookshelf 2
- poj-3628-Bookshelf 2
- POJ3628 Bookshelf 2
- poj3628-Bookshelf 2
- poj 3628 Bookshelf 2
- POJ 3628 Bookshelf 2
- POJ 3628 Bookshelf 2
- 从头到尾彻底理解KMP
- nginx日志记录post的参数
- Android Http get post请求
- 牛顿插值法 matlab版算法
- eclipse中新建maven项目
- POJ_3627 Bookshelf
- dedecms后台登录提示Call to undefined function getcururl()解决办法
- Log使用
- 第14&15题 Remove Duplicates from Sorted Array I&II
- nginx内置预定义变量
- Jetty 的工作原理以及与 Tomcat 的比较
- Poj--1045
- Climbing Stairs
- Dede自动采集伪原创发布更新一体化插件