SPOJ STAMPS
来源:互联网 发布:大数据时代的营销变革 编辑:程序博客网 时间:2024/05/17 08:09
// http://www.spoj.com/problems/STAMPS/#include <iostream>#include <queue>using namespace std;int main() {ios_base::sync_with_stdio(false); int t;cin >> t;int s = 1;while (t-- >0) {int target, np;cin >> target >> np;priority_queue<int> friends;for (int i = 0; i <np; i++) {int stampes;cin >> stampes;friends.push(stampes);}int borrowed = 0;int borrowedpeople = 0;while (borrowed < target && borrowedpeople<np) {borrowed += friends.top();friends.pop();borrowedpeople++;}cout << "Scenario #" << s << ":" << endl;if (borrowed < target) {cout << "impossible" << endl;} else {cout << borrowedpeople << endl;}cout << endl;s++;}}
0 0
- SPOJ STAMPS
- stamps
- Stamps
- STAMPS
- USACO 3.1 Stamps (stamps)
- USACO3.1.5 Stamps (stamps)
- USACO3.1.5 Stamps (stamps)
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- Java设计模式之组合模式(Composite)
- keil 不能下断点的解决方法
- 论涂装的重要性
- Java事件处理机制- 事件监听器的四种实现方式
- DIV Display属性和Visibility属性
- SPOJ STAMPS
- Android的入门学习一
- HDU3086-追及问题-解一元二次方程组
- 在iOS上使用ffmpeg播放视频
- 归去来
- 编译Android下可用的FFmpeg+x264
- webgrid 用法 asp.net mvc
- OkHttp–支持SPDY协议的高效HTTP库
- HDU3339 最短路加01背包