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. UML基础知识点

    UML   :   unified Modeling Language  统一建模语言 1.对系统问题进行分析和建模 2.非专利的第三代建模和规约语言 3.UML是一种开放的方法.用于说明.可视化.构 ...

  2. angular-应用

    什么是SPA 真正的 AngularJS 单页 Web 应用(single page web application,SPA) 一些基础概念 <html> 元素是 AngularJS 应用 ...

  3. gdb学习-checkpoint,watch

    checkpoint的内容参考: http://blog.chinaunix.net/uid-23629988-id-2943273.html 这一篇主要是checkpoint,在next之前加che ...

  4. poj - 1050 - To the Max(dp)

    题意:一个N * N的矩阵,求子矩阵的最大和(N <= 100, -127 <= 矩阵元素 <= 127). 题目链接:http://poj.org/problem?id=1050 ...

  5. Android studio 分32位64位版本吗?

    下载的时候,是不分32位和64位的.安装完成之后,在bin目录下,有studio.exe和studio64.exe这两个文件.前一个是32位的,后一个是64位的.根据自己的电脑进行选择.

  6. maven关于pom文件配置详解(转载)

    转载:http://www.cnblogs.com/hafiz <project xmlns="http://maven.apache.org/POM/4.0.0" xmln ...

  7. ubuntu18.04中安装iNode

    title: ubuntu18.04中安装iNode toc: false date: 2018-09-01 17:52:20 categories: methods tags: ubuntu iNo ...

  8. bower 代理

    bower 设置: 修改 .bowerrc 文件(如无则新增): { "proxy": "http://proxy.mysite.com:8080", &quo ...

  9. div内快元素[div,p。。。]居中办法

    方法1: .parent { width:800px; height:500px; border:2px solid #000; position:relative; } .child { width ...

  10. 记我安装Caffe的血泪史(2)

    不知不觉居然花了一个星期来安装Caffe...真是醉了. 接上一篇blog,本以为编译完cuda,opencv之后问题就差不多了(其实本来是没有什么问题的,但硬是被我搞了一堆事情出来....) 出于对 ...