FZU -2212 Super Mobile Charger(水题)
Problem 2212 Super Mobile ChargerAccept: 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
3 10
100 99 90
3 1000
0 0 0
Sample Output
3
Source
第六届福建省大学生程序设计竞赛-重现赛(感谢承办方华侨大学)
#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(水题)的更多相关文章
- FZU 2212 Super Mobile Charger(超级充电宝)
[Description] [题目描述] While HIT ACM Group finished their contest in Shanghai and is heading back Harb ...
- FZU 2212 Super Mobile Charger 第六届福建省赛
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2212 题目大意: 现在有n个手机,一个电量为m%(百分之m)的万能充电宝 然后输入n个手机的现有电量(百分之a ...
- (比赛)B - Super Mobile Charger
B - Super Mobile Charger Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- ACM: FZU 2110 Star - 数学几何 - 水题
FZU 2110 Star Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Pr ...
- fzu 2135 数字游戏 【水题】
Problem 2135 数字游戏 Accept: 253 Submit: 392Time Limit: 1000 mSec Memory Limit : 32768 KB Problem ...
- FZOJ--2212--Super Mobile Charger(水题)
Problem 2212 Super Mobile Charger Accept: 3 Submit: 11 Time Limit: 1000 mSec Memory Limit : 32 ...
- FZU 1343 WERTYU --- 水题
FZU 1343 题目大意:手放在键盘上时,稍不注意就会往右错一位.这样Q就会输入成W,输入J就会变成K 给定一串大写敲错后输入,输出正确的输入(输入保证合法,如输入中不会出现Q,A,Z): 解题思路 ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
随机推荐
- 【Radial Basis Function Network】林轩田机器学习技法
这节课主要讲述了RBF这类的神经网络+Kmeans聚类算法,以及二者的结合使用. 首先回归的了Gaussian SVM这个模型: 其中的Gaussian kernel又叫做Radial Basis F ...
- ASP NET Core ---Automapper
官方文档:http://docs.automapper.org/en/stable/index.html 一.安装和配置: 二.使用: 1.建立 Profile文件: public class Map ...
- Python网络编程(子进程的创建与处理、简单群聊工具)
前言: 昨天我们已经了解了多进程的原理以及它的实际使用 Unix/Linux操作系统提供了一个fork()系统调用,它非常特殊.普通的函数调用,调用一次,返回一次, 但是fork()调用一次,返回两次 ...
- pandas.read_csv to_csv参数详解
pandas.read_csv参数整理 读取CSV(逗号分割)文件到DataFrame 也支持文件的部分导入和选择迭代 更多帮助参见:http://pandas.pydata.org/pandas ...
- C# MemoryCache 类[转载]
原网址:http://www.cmono.net/post/read/156 MemoryCache 类是.Net .0推出的类库,主要是为了方便在Winform和Wpf中构建缓存框架的 Object ...
- quagga源码学习--BGP协议中的routemap
路由策略的基础知识 定义 路由策略(Routing Policy)作用于路由,主要实现了路由过滤和路由属性设置等功能,它通过改变路由属性(包括可达性)来改变网络流量所经过的路径. 目的 路由器在发布. ...
- Spring2集成iBatis2
从数据库中查询一条记录,演示Spring与iBatis的集成 1 编写sqlmaps与Domain对象 <?xml version="1.0" encoding=" ...
- 自动设置 rem es模块写法
export default function () { let html = document.documentElement; function onWindowResize() { if (ht ...
- unicode 编码在线转换工具--javascript
http://www.cnblogs.com/mq0036/p/4007452.html
- MAC使用IDA PRO远程调试LINUX程序
1 背景 在学习Linux系统上的一些漏洞知识的时候,往往需要进行“实地测试”,但是在Linux系统上进行调试并不太方便,因为LINUX自带的GDB调试工具真的不太人性化,即使有GDBTUI之类的“伪 ...