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的更多相关文章
随机推荐
- Template msg
http://blog.csdn.net/xiejiawanwei2_bb/article/details/40680493 {{first.DATA}} 日期:{{Day.DATA}} 报警类型:{ ...
- Tomcat设置默认时区
本文讲解如何在tomcat启动时设置JVM默认时区. 环境:JDK1.8.114 web容器:Tomcat 9 tomcat启动脚本 /etc/init.d/tomcat 操作系统ubuntu 16 ...
- Extended Backus–Naur Form
From Wikipedia, the free encyclopedia In computer science, Extended Backus–Naur Form (EBNF) is a fam ...
- Codeforces 709C 模拟
C. Letters Cyclic Shift time limit per test:1 second memory limit per test:256 megabytes input:stand ...
- 使用nmon来按频率采集数据
# nmon -s1 -c60 -f -m /home/nmon # ll /home/nmon/ total 15220 -rw-r--r-- 1 root root 23923 Oct 14 ...
- 2018.08.05 bzoj3223: Tyvj 1729 文艺平衡树(非旋treap)
传送门 经典的平衡树问题,之前已经用splay写过一次了,今天我突发奇想,写了一发非旋treap的版本,发现挺好写的(虽然跑不过splay). 代码: #include<bits/stdc++. ...
- 44 The shopping psychology 购物心理
The shopping psychology 购物心理 ①People can be addicted to different things ---e. g.,alcohol, drugs, ce ...
- (转) MVC身份验证及权限管理-1
转自:http://blog.csdn.net/kenshincui/article/details/5559508 MVC自带的ActionFilter 在Asp.Net WebForm的中要做到身 ...
- hdu 5062 单峰数(12321)的个数
http://acm.hdu.edu.cn/showproblem.php?pid=5062 模拟筛出对称单峰数(12321)的个数,水题 #include <cstdio> #inclu ...
- express 阮一峰的博客
http://javascript.ruanyifeng.com/nodejs/express.html next没怎么用过... 一个不进行任何操作.只传递request对象的中间件 functio ...