FZU -2212 Super Mobile Charger(水题)

Accept: 1033 Submit: 1944
Time Limit: 1000 mSec Memory Limit : 32768 KB
Problem Description
While HIT ACM Group finished their contest in Shanghai and is heading back Harbin, their train was delayed due to the heavy snow. Their mobile phones are all running out of battery very quick. Luckily, zb has a super mobile charger that can charge all phones.
There are N people on the train, and the i-th phone has p[i] percentage of power, the super mobile charger can charge at most M percentage of power.
Now zb wants to know, at most how many phones can be charged to full power. (100 percent means full power.)
Input
The first line contains an integer T, meaning the number of the cases (1 <= T <= 50.).
For each test case, the first line contains two integers N, M(1 <= N <= 100,0 <= M <= 10000) , the second line contains N integers p[i](0 <= p[i] <= 100) meaning the percentage of power of the i-th phone.
Output
For each test case, output the answer of the question.
Sample Input
3 10
100 99 90
3 1000
0 0 0
Sample Output
3
Source
第六届福建省大学生程序设计竞赛-重现赛(感谢承办方华侨大学)
- #include <iostream>
- #include<algorithm>
- using namespace std;
- int a[150];
- int main()
- {
- std::ios::sync_with_stdio(false);
- int t;
- cin>>t;
- while(t--){
- int n,m;
- cin>>n>>m;
- for(int i=0;i<n;i++){
- cin>>a[i];
- a[i]=100-a[i];
- //cout<<"i=="<<a[i]<<endl;
- }
- sort(a,a+n);
- int ans=0;
- for(int i=0;i<n;i++){
- if(a[i]!=0){
- if(m>=a[i]){
- m-=a[i];
- ans++;
- }
- }
- else{
- ans++;
- }
- }
- cout<<ans<<endl;
- }
- return 0;
- }
FZU -2212 Super Mobile Charger(水题)的更多相关文章
- FZU 2212 Super Mobile Charger(超级充电宝)
[Description] [题目描述] While HIT ACM Group finished their contest in Shanghai and is heading back Harb ...
- FZU 2212 Super Mobile Charger 第六届福建省赛
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2212 题目大意: 现在有n个手机,一个电量为m%(百分之m)的万能充电宝 然后输入n个手机的现有电量(百分之a ...
- (比赛)B - Super Mobile Charger
B - Super Mobile Charger Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- ACM: FZU 2110 Star - 数学几何 - 水题
FZU 2110 Star Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Pr ...
- fzu 2135 数字游戏 【水题】
Problem 2135 数字游戏 Accept: 253 Submit: 392Time Limit: 1000 mSec Memory Limit : 32768 KB Problem ...
- FZOJ--2212--Super Mobile Charger(水题)
Problem 2212 Super Mobile Charger Accept: 3 Submit: 11 Time Limit: 1000 mSec Memory Limit : 32 ...
- FZU 1343 WERTYU --- 水题
FZU 1343 题目大意:手放在键盘上时,稍不注意就会往右错一位.这样Q就会输入成W,输入J就会变成K 给定一串大写敲错后输入,输出正确的输入(输入保证合法,如输入中不会出现Q,A,Z): 解题思路 ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
随机推荐
- Pascal “内存病毒”(骗人的)
Pascal内存病毒 Chaobs从互联网上获得 pascal病毒虽然说只用Ctrl+Pause Break就可以关闭,但是像有些程序一旦启动,不用等你找到那两个键,就自己运行结束关闭了.比如下面一个 ...
- thinkphp3.1.3验证码优化
现状 thinkphp3.1.3版本中的验证码字符分布不均匀,在自定义宽高时很明显. 调用代码: Image::buildImageVerify(6, 5, 'png', 150, 50); 生成的验 ...
- CSS系列(5)-如何使用Firebug查看网页的html和css
Firebug是火狐浏览器Firefox的一个插件,专门为开发人员开发的.使用Firebug需要先在Firefox中安装这个插件,网上有很多教程,可以对照着安装一下. 不同的火狐浏览器版本中的Fire ...
- 恢复误删除表黑科技之relay log大法(续)
Preface I've stuck twice in my previous experiments in backing up dropped tables.I am still ...
- cloud-init代码调试方法
新做的centos7.4镜像的cloud-init安装好之后,修改密码失败,但是同样的配置文件在7.2上的是正常的,对比了一下版本,centos7.4上的是0.7.9,7.2上的是0.7.5,经过调试 ...
- 网络编程--广播&组播
广播 1.广播地址 如果用{netid, subnetid, hostid}( {网络ID,子网ID,主机ID})表示IPv4地址.那么有四种类型的广播地址,我们用-1表示所有比特位均为1的字段: 1 ...
- shell之基本语法
转: read 命令从 stdin 获取输入并赋值给 PERSON 变量,最后在 stdout 上输出: #!/bin/bash # Script follows here: echo " ...
- SOA与WCF
背景: 高校平台马上就要进入编程阶段了,对于没怎么做过正式项目的我们来说,要学的东西实在太多了.一下子面对这么多学习资料时,我们也不能着急,还是踏踏实实,一个一个地去了解,其实他们都没那么神秘.这篇博 ...
- RabbitMQ吞吐量测试-PerfTest上
RabbitMQ吞吐量测试-PerfTest上 PerfTest RabbitMQ有一个基本的吞吐量测试工具PerfTest(文档,源代码和版本),它基于Java客户端,可以配置为模拟基本工作负载.P ...
- 2017 多校2 hdu 6053 TrickGCD
2017 多校2 hdu 6053 TrickGCD 题目: You are given an array \(A\) , and Zhu wants to know there are how ma ...