FZOJ--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
Sample Output
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(水题)的更多相关文章
- FZU -2212 Super Mobile Charger(水题)
Problem 2212 Super Mobile Charger Accept: 1033 Submit: 1944Time Limit: 1000 mSec Memory Limit ...
- 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 & ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
随机推荐
- 题目1437:To Fill or Not to Fill(贪心算法)
题目描写叙述: With highways available, driving a car from Hangzhou to any other city is easy. But since th ...
- 搜狗面试的经典题(C++map按值排序,class struct的差别)
一:起因 (1)java Map排序(key,value).请看还有一篇博客 java Map排序 (2)c++ map排序(key,value),能够对c++ map和java Map进行对照:之 ...
- 一个build.xml实例
<?xml version="1.0"?> <project name="ssh" basedir="." default ...
- MongoDB数据模型和索引学习总结
MongoDB数据模型和索引学习总结 1. MongoDB数据模型: MongoDB数据存储结构: MongoDB针对文档(大文件採用GridFS协议)採用BSON(binary json,採用二进制 ...
- 剪切具有CornerRadius的RectangleGeometry(可能在Ripple中用到)
剪切具有CornerRadius的RectangleGeometry(可能在Ripple中用到) 1.新建Converter public class BorderClipConverter : IM ...
- 37、ifconfig命令
很多windows很熟悉ipconfig命令行工具.它被用来获取网络接口配置信息并对此进行改动.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config). 通常须 ...
- rails数据库操作rake db一点心得
问题描述,对于很多的新手rails lover来说,搞定db是件头疼的事情,当建立了一个model,测试了半天发现我草列名写错了,再过一会儿发现association里面竟然没有xxx_id,这下子s ...
- 【学习】java下实现调用oracle的存储过程和函数
在oracle下创建一个test的账户,然后按一下步骤执行: 1.创建表:STOCK_PRICES --创建表格CREATETABLE STOCK_PRICES( RIC VARCHAR(6) PRI ...
- http状态码304
服务器对客户端返回HTTP/1.1 304 意思是服务端告诉客户端 我的的缓存没有改变你不需要来取了,就用你自己本地的吧! 浏览器的三种缓存协商机制: if-modified-since (基于最后 ...
- UVA-12083 Guardian of Decency 二分图 最大独立集
题目链接:https://cn.vjudge.net/problem/UVA-12083 题意 学校组织去郊游,选择最多人数,使得任意两个人之间不能谈恋爱 不恋爱条件是高差大于40.同性.喜欢的音乐风 ...