jzoj2941
我們可以暴力枚舉每一個人分幾個糖果,再暴力統計答案即可
每次遞歸下去可以從1-n號人,決定選多少個糖果再遞歸
#include<bits/stdc++.h>
using namespace std;
int n,k;
double a,r,x[1000],y[1000],s;
void get(int d,double p,double ss,int c){
if(d==n+1){
if(c>n/2)s+=p;
else s+=p*(a/((a+ss)));
return;
}
get(d+1,p*y[d]/100.0,ss,c+1);
get(d+1,p*(100.0-y[d])/100.0,ss+x[d],c);
}
void dfs(int x,int k){
if(k==0){//用來剪枝
s=0;
get(1,1,0,0);
r=max(r,s);
return;
}
if(x==n+1)return;
for(int i=0;i<=k;i++)
if(y[x]+i*10<=100){
y[x]+=i*10;
dfs(x+1,k-i);
y[x]-=i*10;
}
}
int main(){
scanf("%d%d%lf",&n,&k,&a);
for(int i=1;i<=n;i++)
scanf("%lf%lf",&x[i],&y[i]);
double ans=0;
for(int i=1;i<=n;i++)
ans+=(100.0-y[i]);
if(ans<=k*10){
printf("1.000000");
return 0;
}
dfs(1,k);
printf("%.6lf",r);
}
jzoj2941的更多相关文章
随机推荐
- mRemoteNG
mRemoteNG 1.摆脱了mstsc那种一个程序一个界面的模式,采用了左边树+右边Tab页的显示形式,让你在一个mRemote界面中,可以连接多个远程桌面,再也不用为切来切去而烦恼了(如上图). ...
- 【转】MEF程序设计指南三:MEF中组合部件(Composable Parts)与契约(Contracts)的基本应用
按照MEF的约定,任何一个类或者是接口的实现都可以通过[System.ComponentModel.Composition.ExportAttribute] 特性将其定义为组合部件(Composabl ...
- VK Cup 2016 D. Bear and Two Paths 模拟
D. Bear and Two Paths time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- jquery节点获取
jQuery.parent(expr) 找父亲节点,可以传入expr进行过滤,比如$("span").parent()或者$("span").parent(& ...
- jmeter写好的脚本检查无误之后就是无法执行成功
今天,用jmeter写好的脚本,检查了好几遍,没有任何错误,但是执行的时候命令发送总是失败,没有cookie,请教高手,才得以解决. 重新创建一个HTTP request,把之前写好的都一一拷贝过来, ...
- 6. Manage the driver for browser and the script for Hub
- Python3 urllib库和requests库
1. Python3 使用urllib库请求网络 1.1 基于urllib库的GET请求 请求百度首页www.baidu.com ,不添加请求头信息: import urllib.requests d ...
- 2018.08.17 bzoj4653: [Noi2016]区间(线段树+尺取法)
传送门 将坐标离散化之后直接用尺取法(双指针)+线段树维护. 其实就是说只要目前所有点的被覆盖次数是大于等于m的就移动左指针删除区间更新答案,否则移动右指针加入区间更新答案. 话说忘记排序以及建树的时 ...
- C#打印日志的小技巧
public static void Log(params System.Object[] message) { string str = ""; if (message == n ...
- java判断字符串是否为数字,包括负数
/** * 判断是否为数字,包含负数情况 * @param str * @return */ private boolean isNumeric(String str){ Boolean flag = ...