Problem 2212 Super Mobile Charger

Accept: 3    Submit: 11
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

23 10100 99 903 10000 0 0

Sample Output

23

Source

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


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int num[100100];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m;
memset(num,0,sizeof(num));
scanf("%d%d",&n,&m);
int x;
for(int i=0;i<n;i++)
{
scanf("%d",&x);
num[i]=100-x;
}
sort(num,num+n);
int ans=0;
for(int i=0;i<n;i++)
{
if(m>=num[i])
{
m-=num[i];
ans++;
}
}
printf("%d\n",ans);
}
return 0;
}

FZOJ--2212--Super Mobile Charger(水题)的更多相关文章

  1. FZU -2212 Super Mobile Charger(水题)

     Problem 2212 Super Mobile Charger Accept: 1033    Submit: 1944Time Limit: 1000 mSec    Memory Limit ...

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

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

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

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

  4. (比赛)B - Super Mobile Charger

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

  5. HDU 5538 L - House Building 水题

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

  6. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  7. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  8. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  9. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

随机推荐

  1. maven规定的目录

    Maven规定的目录结构 若要使用Maven,那么项目的目录结构必须符合Maven的规范 ,如写一个使用Spring的Web项目就需要引入大量的jar包.一个项目Jar包的数量之多往往让我们瞠目结舌, ...

  2. [AngularJS]Chapter 3 使用AngularJS构建应用程序

    本章内容提要: 如何布置AngularJS进行快速开发 开启服务器进行测试 使用Karma进行单元测试用例测试 编译压缩AngularJS进行生产 使用Batarang进行Debug 如何简化开发工作 ...

  3. Scratch单机版下载

    Scratch单机版下载 这两个地址速度比较快: Adobe Air:http://7dx.pc6.com/wwb5/AdobeAIR2800127.zip Scratch :http://7dx.p ...

  4. 机器学习之&amp;&amp;Andrew Ng课程复习--- 聚类——Clustering

    第十三章.聚类--Clustering ******************************************************************************** ...

  5. 确保 Xcode 每次 Build 时都自己主动更新资源

    參考:p=22" target="_blank">http://quick.cocoachina.com/?p=22 刚建立的quickproject.每次修改lu ...

  6. POJ 3664 Election Time 题解

    这道题网上非常多人都会说easy,水题之类的话,只是我看了下说这种话的人的程序,能够说他们的程序都不及格! 为什么呢?由于他们的程序都是使用简单的二次排序水过(大概你能搜索到的多是这种程序).那样自然 ...

  7. AWS使用心得:当初我曾错过的那些宝贵经验

    在今天的文章中,我整理出了大量当初以前错过.而至今仍将我追悔莫及的Amazon Web Services(简称AWS)使用心得. 在几年来的实践其中,我通过在AWS之上新手构建及部署各类应用程序而积累 ...

  8. c语言中类型转换与赋值运算符、算术运算符、关系运算符、逻辑运算符。原码、反码、补码。小解。

    类型转换 自动转换 小范围的类型能够自动转换成大范围的类型.short->int->long->float->double 强制类型转换 (类型名)变量或数值 #include ...

  9. 跨域调用接口——WebClient通过get和post请求api

    AJAX不可以实现跨域请求,经过特殊处理才行.一般后台可以通过WebClient实现跨域请求~ //get 请求        string url = string.Format("htt ...

  10. [ Linux ] [ OS ] [ CPU ] Linux系統 OS, CPU, Memory, Disk

    查看 linux 版本 及 Kernel 版本 指令: cat /etc/*-release http://benit.pixnet.net/blog/post/19390916-%E5%A6%82% ...