Problem 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

2
3 10
100 99 90
3 1000
0 0 0

 Sample Output

2
3

 Source

第六届福建省大学生程序设计竞赛-重现赛(感谢承办方华侨大学)

题意:

现在有n个手机,一个电量为m%(百分之m)的万能充电宝
然后输入n个手机的现有电量(百分之a[i]),现在问你这个万能充电宝能把几个手机充满(电量为百分之百)。
 
思路:排序水题,签到题
 
代码:
#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(水题)的更多相关文章

  1. FZU 2212 Super Mobile Charger(超级充电宝)

    [Description] [题目描述] While HIT ACM Group finished their contest in Shanghai and is heading back Harb ...

  2. FZU 2212 Super Mobile Charger 第六届福建省赛

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=2212 题目大意: 现在有n个手机,一个电量为m%(百分之m)的万能充电宝 然后输入n个手机的现有电量(百分之a ...

  3. (比赛)B - Super Mobile Charger

    B - Super Mobile Charger Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

  4. ACM: FZU 2110 Star - 数学几何 - 水题

     FZU 2110  Star Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u  Pr ...

  5. fzu 2135 数字游戏 【水题】

    Problem 2135 数字游戏 Accept: 253    Submit: 392Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem ...

  6. FZOJ--2212--Super Mobile Charger(水题)

    Problem 2212 Super Mobile Charger Accept: 3    Submit: 11 Time Limit: 1000 mSec    Memory Limit : 32 ...

  7. FZU 1343 WERTYU --- 水题

    FZU 1343 题目大意:手放在键盘上时,稍不注意就会往右错一位.这样Q就会输入成W,输入J就会变成K 给定一串大写敲错后输入,输出正确的输入(输入保证合法,如输入中不会出现Q,A,Z): 解题思路 ...

  8. fzuoj Problem 2182 水题

    http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188    Submit: 277Time Limit: 100 ...

  9. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

随机推荐

  1. 《Cracking the Coding Interview》——第1章:数组和字符串——题目2

    2014-03-18 01:30 题目:反转一个char *型的C/C++字符串. 解法:一头一尾俩iterator,向中间靠拢并且交换字符. 代码: // 1.2 Implement a funct ...

  2. android surfaceview 入门介绍

    由于工作中需自定义控件,以前没写过. 开始时,实用view 实现了,经理说不好,担心效率低,要求每秒需要刷新10次左右. 然后,学习使用  surfaceview. 看了网上简单的Demo,找到him ...

  3. JMeter学习笔记(六) 文件下载接口测试

    本次测试的是文件下载接口,文件是PDF文档,步骤如下: 1.通过jmeter的录制功能,获取了文件下载接口的地址和参数,和其他的HTTP请求一样的配置 2.执行此接口后,察看结果树,点击下载接口的结果 ...

  4. Java 中的 I/O 抽象

    Table of Contents 前言 字节流 常用实现 字符流 常用实现 缓冲区 各种字节流 结语 前言 由于在接触 Java 之前使用的语言是 Python,所以在转到 Java 后对 Java ...

  5. 孤荷凌寒自学python第二十八天python的datetime.date模块

     孤荷凌寒自学python第二十八天python的datetime.date模块 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) 一.toordinal() 此方法将访问从公元1年1月1日至当 ...

  6. Windows批处理中获取日期和时间

    编写Windows bat 批处理时经常会需要使用到日期和时间作为文件名,所以是非常重要的. 如何获取日期呢? 格式: %date% 结果: -- 如何获取时间呢? 格式: %time% 结果: :: ...

  7. PAT——甲级1065:A+B and C(64bit) 乙级1010一元多项式求导

    甲级1065 1065 A+B and C (64bit) (20 point(s)) Given three integers A, B and C in [−2​63​​,2​63​​], you ...

  8. kvm搭建完成了,那么问题来了,到底是什么原理

    kvm中到底是怎么模拟的CPU和内存? 收到了大量的 这里有一个裸的调用kvm接口的实例,超赞: http://www.cnblogs.com/Bozh/p/5753379.html 使用kvm的AP ...

  9. hdu 2579 Dating with girls(2) (bfs)

    Dating with girls(2) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  10. DataBase -- SQL INNER JOIN

    SQL INNER JOIN 关键字 在表中存在至少一个匹配时,INNER JOIN关键字返回行. INNER JIN关键字语法 SELECT column_name(s) FROM table_na ...