hdu--2570--迷瘴(贪心)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int c;
cin>>c;
while(c--){
int n,v,w;
cin>>n>>v>>w;
vector<int> vec;
for(int i=;i<n;++i){
int temp;cin>>temp;
vec.push_back(temp);
}
sort(vec.begin(),vec.end());
double sum=;
int cut=;
for(auto it=vec.begin();it!=vec.end();++it){
sum+=(*it);cut++;
if(sum>w*cut){
sum-=(*it);cut--;break;
}
}
if(cut == ){
cout<<"0 0.00\n";
}else printf("%d %0.2lf\n",cut*v,sum*0.01/cut);//注意要/100,第一次忘了
}
return ;
}
hdu--2570--迷瘴(贪心)的更多相关文章
- --hdu 2570 迷瘴(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2570 Ac code: #include<stdio.h> #include<std ...
- HDU 2570:迷瘴
迷瘴 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...
- hdu_2570 迷障 贪心
迷瘴 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submissi ...
- 【九度OJ】题目1435:迷瘴 解题报告
[九度OJ]题目1435:迷瘴 解题报告 标签(空格分隔): 九度OJ http://ac.jobdu.com/problem.php?pid=1435 题目描述: 通过悬崖的yifenfei,又面临 ...
- HDU 4442 Physical Examination(贪心)
HDU 4442 Physical Examination(贪心) 题目链接http://acm.split.hdu.edu.cn/showproblem.php?pid=4442 Descripti ...
- hdu 2570 贪心
贪心的经典题型 该死的精度问题,WA了好几次,以后能用乘的绝不用除!! #include<iostream> #include<algorithm> #include<c ...
- hdu 1050 Moving Tables(迷之贪心...)
题意:有400间房间按题目中图片所给的方式排列,然后给出要移动的n张桌子所要移动的范围,每张桌子要移动的范围不能出现重叠的区域:问最少要多少次才能移动完所有的桌子. 题解思路:把题目转换下,就是有n个 ...
- HDU 5835 Danganronpa (贪心)
Danganronpa 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5835 Description Chisa Yukizome works as ...
- HDU 5821 Ball (贪心)
Ball 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5821 Description ZZX has a sequence of boxes nu ...
- hdu 4004 (二分加贪心) 青蛙过河
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4004 题目意思是青蛙要过河,现在给你河的宽度,河中石头的个数(青蛙要从石头上跳过河,这些石头都是在垂 ...
随机推荐
- VS使用WEB DEPLOY发布
背景是这样的,公司有两台服务器,平时一台备用,另一台做为主生产机器.当有大量补丁或者安装什么东西需要重启的时候,交其中一台直接关掉IIS,然后重启即可,此时另一台负责处理用户请求. 之前一台服务器一个 ...
- html 自动跳转,meat(http-equiv)标签详解
http-equiv顾名思义,相当于http的文件头作用,它可以向浏览器传回一些有用的信息,以帮助正确和精确地显示网页内容,与之对应的属性值为content,content中的内容其实就是各个参数的变 ...
- Modeling of Indoor Positioning Systems Based on Location Fingerprinting
Kamol Kaemarungsi and Prashant Krishnamurthy Telecommunications Program School of Information Scienc ...
- Python菜鸟之路:Python基础-操作缓存memcache、redis
一.搭建memcached和redis 略,自己去百度吧 二.操作Mmecached 1. 安装API python -m pip install python-memcached 2. 启动memc ...
- python爬虫之request and BeautifulSoup
1.爬虫的本质是什么? 模仿浏览器的行为,爬取网页信息. 2.requests 1.get请求 无参数实例 import requests ret = requests.get('https://gi ...
- Java & 混型
1.C++ & 混型 C++能够记住其模板参数的类型,对于混型来说,使用参数化类型更加优雅. #include <string> #include <ctime> #i ...
- Linux中假设系统丢失了ls命令
假设系统丢失了ls命令,如何修复: 1.查询ls命令属于那个rpm包[root@localhost ~]# rpm -qf /bin/lscoreutils-8.4-43.el6.x86_64 2.挂 ...
- linux c编程:进程控制(四)进程调度
当系统中有多个进程到时候,哪个进程先执行,哪个进程后执行是由进程的优先级决定的.进程的优先级是由nice值决定的.nice值越小,优先级越高.可以看做越友好那么调度优先级越低.进程可以通过nice函数 ...
- Android Resources
Ref:Android开发最佳实践 Ref:Android高手速成--第一部分 个性化控件(View) Ref:Android高手速成--第二部分 工具库 Ref:Android高手速成--第三部分 ...
- activiti基础--3-----------------------------流程实例
一.流程实例用到的表: select * from act_ru_execution #正在执行的任务表 select * from act_hi_procinst #流程实例的历史表 select ...