【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.)

HIT ACM队完成了上海的比赛正要回哈尔滨,谁知他们的火车却因大雪晚点了。他们的手机电量告急。不过没关系,zb随身携带了一个可以适配所有手机的超级充电宝。

火车上有N个人,第i个手机的剩余电量百分比为p[i],这个超级充电宝最多只能充百分之M的电量。

现在zb想知道,最多有多少部手机可以充满电。(百分百表示手机充满电。)

【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.

输入的首行是一个整数T表示测试样例的数量(1 <= T <= 50。)。

对于每个测试样例,第一行包含两个整数N,M(1 <= N <= 100,0 <= M <= 10000),第二行有N个整数p[i](0 <= p[i] <= 100)表示第i个手机的剩余电量百分百。

【Output】

【输出】

For each test case, output the answer of the question.

每个测试样例输出其最多充满电的手机数量。

【Sample Input - 输入样例】

【Sample Output - 输出样例】

2

3 10

100 99 90

3 1000

0 0 0

2

3

【题解】

一共有M的电,要充满尽可能多的手机,排个序,然后看看M能撑几部手机,输出结果,没了。

 #include<cstdio>
#include<algorithm>
int main(){
freopen("1.txt", "r", stdin);
int t, n, m, i, j, s, data[];
scanf("%d", &t);
while (t--){
scanf("%d%d", &n, &m);
for (s = i = ; i < n; ++i) scanf("%d", &j), data[i] = j - ;
std::sort(data, data + n);
for (--n; ~n; --n){
m += data[n];
if (m>) ++s;
else break;
}
printf("%d\n", s);
}
return ;
}

FZU 2212

FZU 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 第六届福建省赛

    题目链接: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. FZOJ--2212--Super Mobile Charger(水题)

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

  5. UPYUN云服务体验计划,阅读神器Kindle、LaCie移动硬盘、索尼大法充电宝、高大上极路由、UPYUN代金券等你拿!

    请看以下的“通关攻略”,分享你对云服务的“体验心得”,即可赢取绝佳的“通关宝藏”,阅读神器Kindle.LaCie移动硬盘.索尼大法充电宝.高大上极路由.UPYUN代金券等你拿!先来了解下UPYUN能 ...

  6. 华为:向充电宝说再见!有它,手机24h不断电

    编辑 | 于斌 出品 | 于见(mpyujian) 虽然,美国与中国的谈判还在协商中,不知道最后的消息是好是坏. 但最近华为公司的成绩,却值得让我们为其喝彩和感到骄傲. 据悉,30日,华为在上半年业绩 ...

  7. 三年无限流量免费随身WiFi充电宝是真的还是套路?

    一般来说大家现在看到"无限流量"."免费"等字眼,总会有一种"这是陷阱"."这是大坑"."就要黑你钱" ...

  8. [LeetCode] Super Ugly Number 超级丑陋数

    Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all ...

  9. [LeetCode] 313. Super Ugly Number 超级丑陋数

    Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all ...

随机推荐

  1. blade模版之页面的嵌套

    blade模版 相关关键词:@section @yield @extends @extends @show @parent(追加内容而不是覆盖) 父页面view\layout\f.blade.php ...

  2. 为什么anylase和scenaio中的平均响应时间差别会这么大?

    场景里的响应时间截图如下所示: 结果里的响应时间截图如下所示:

  3. oracle 存储过程发邮件

    CREATE OR REPLACE PROCEDURE PROCSENDEMAIL(P_TXT       VARCHAR2,                                      ...

  4. Nagios监控Oralce

    一.本文说明: 本文是监控本地的Oracle,其实监控远端的Oracle也是跟下面的步骤差不多的. 二.安装Nagios.Nagios插件.NRPE软件: 安装步骤可以参考<Linux下Nagi ...

  5. springMVC配置freemarker 二(问题讨论篇)

    上面一篇我已经说明了如何去配置freemarker,这里我就谈谈遇到的问题吧. 首先, 为什么要删除上面之前的.你要使用freemarkerviewresolver和上面的冲突了,因此要注释掉上面的. ...

  6. 线程和进程详解(以java为例具体说明)

    详细参见http://ifeve.com/java-concurrency-thread-directory/ 一.线程概述 线程是程序运行的基本执行单元.当操作系统(不包括单线程的操作系统,如微软早 ...

  7. FZU 2105 Digits Count(线段树)

    Problem 2105 Digits Count Accept: 302 Submit: 1477 Time Limit: 10000 mSec Memory Limit : 262144 KB P ...

  8. 遍历寻找json中的重复数据

    string str = "[{\"ID\":1,\"Data\":{\"subjectCode\":\"1\" ...

  9. bash中一些基础知识

    bash是linux操作系统的shell.以下是Multi-Perspective Sentence Similarity Modeling论文实现时碰到的一个bash: #!/bin/bash py ...

  10. 分分钟知道tiles框架是干嘛的

    分分钟知道tiles框架是干嘛的 http://blog.sina.com.cn/s/blog_a123d4d50101792d.html参考上面的文章,简单明了.让你一下子就知道这个是用来做什么的. ...