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. USACO Section1.3 Ski Course Design 解题报告

    skidesign解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------ ...

  2. navmesh自动寻路

    一个导航网格(也就是Navmesh)是世界几何体简化的表示法,被游戏代理用于在世界中进行导航.通常,代理(agent )有一个目标,或一个目的地,它试图找到一个路径,然后沿路径导航到达目标.这个过程被 ...

  3. Entity Framework(四)--EF原理和状态管理

    一.原理: 如何查看真正执行的SQL是怎样的? DbContext有一个Database属性,Database属性有一个Log属性,是Action委托类型其中的参数就是sql语句,每次EF执行sql语 ...

  4. C#泛型和泛型约束

    一.泛型: 所谓泛型,即通过参数化类型来实现在同一份代码上操作多种数据类型.泛型编程是一种编程范式,它利用“参数化类型”将类型抽象化,从而实现更为灵活的复用. 二.泛型约束: 转自:http://ww ...

  5. Linux(Ubuntu 命令大全)

    Ubuntu 一. Ubuntu简介 Ubuntu(乌班图)是一个基于Debian的以桌面应用为主的Linux操作系统,据说其名称来自非洲南部祖鲁语或科萨语的“ubuntu”一词,意思是“人性”.“我 ...

  6. LeetCode-N皇后

                                          LeetCode-N皇后 n 皇后问题研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击. ...

  7. svn 数据库 账号密码

    47.106.107.201 云商传媒李孔文 2018/8/22 19:26:35 root 云商传媒李孔文 2018/8/22 19:26:39 sn123456 云商传媒李孔文 2018/8/22 ...

  8. poj 3436 网络流构图经典

    ACM Computer Factory Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6012   Accepted: 2 ...

  9. nyoj 题目44 子串和

    子串和 时间限制:5000 ms  |  内存限制:65535 KB 难度:3   描述 给定一整型数列{a1,a2...,an},找出连续非空子串{ax,ax+1,...,ay},使得该子序列的和最 ...

  10. BI商业智能培训系列——(二)SSIS入门

    简介: SSIS,Microsoft SQL Server Integration Services.Integration意为"整合"."一体化".上篇博客中 ...