【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. Java URLClassLoader和ClassLoader

    开始:看名字都带有ClassLoader,叫做类加载器,事实上是可以理解为动态的加载类,不过,也不是只能加载类,也可以加载其他形式的文件,比如说.properties属性文件. 区别:其实在两个类加载 ...

  2. 模拟http响应头

    1.打开需要模拟的页面请求头 2.编码要发送的数据 3.通过fsockopen函数发送请求头 代码如下 //方法二 $URL="http://device.test.com/admin/ma ...

  3. rtc关机闹钟3 IAlarmManager

    vim framework/base/core/java/android/app/IAlarmManager.aidl import android.app.AlarmManager;import a ...

  4. SlickGrid example 5:带子项的展开收缩

    带子项的展开收缩.   代码: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Ty ...

  5. C#委托之泛型

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...

  6. Spring中DispacherServlet、WebApplicationContext、ServletContext的关系

    转载:http://blog.csdn.net/c289054531/article/details/9196149?utm_source=tuicool&utm_medium=referra ...

  7. Multi-Perspective Sentence Similarity Modeling论文demo实现

    由于下载glove时,下载脚本并未自己执行txt文件转.th文件,在执行th trainSIC.lua时报错 需要根据fetch_and_preprocess.sh中的代码利用scripts中的con ...

  8. dot函数和*的区别

    dot函数是常规的矩阵相乘 *是特殊的乘法 import numpy as np a = [[1,2,3],[4,5,6]] a = np.array(a) b = [[1,2],[4,5],[3,6 ...

  9. CentOS 配置solr中文分词器

    第一步:使用IK-Analyzer.把分析器的文件夹上传到服务器. 第二步:需要把分析器的jar包添加到solr工程中. [root@bogon IK Analyzer 2012FF_hf1]# cp ...

  10. 2016年10月29日 星期六 --出埃及记 Exodus 19:14

    2016年10月29日 星期六 --出埃及记 Exodus 19:14 After Moses had gone down the mountain to the people, he consecr ...