CF97C Winning Strategy
CF97C Winning Strategy
这题好玄学鸭。。。都不知道为啥是对的
设\(f[i][j]\)表示打了i轮比赛,有j个参加了一次的人,直接枚举有几个参加了转移过去即可
#include<bits/stdc++.h>
#define il inline
#define vd void
#define ll long long
il int gi(){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
return x*f;
}
double p[101];
double f[2][20001];
int main(){
int n=gi();double ans=0;
for(int i=0;i<=n;++i)scanf("%lf",&p[i]);
int now=0;
memset(f[now],-63,sizeof f[now]);
f[now][0]=0;
for(int i=0;i<=200;++i){
memset(f[now^1],-63,sizeof f[now^1]);
for(int j=0;j<=(i?20000:0);++j){
if(i)ans=std::max(ans,f[now][j]/i);
for(int k=0;k<=n;++k)
if(j+n-k-k>=0&&j+n-k-k<=20000){
f[now^1][j+n-k-k]=std::max(f[now^1][j+n-k-k],f[now][j]+p[k]);
}
}
now^=1;
}
printf("%.10lf\n",ans);
return 0;
}
CF97C Winning Strategy的更多相关文章
- CF97C Winning Strategy 构造、图论
题目传送门:http://codeforces.com/problemset/problem/97/C 题意:给出$n$与一个范围在$[0,1]$内的递增序列$P_0-P_n$,试构造一个无穷序列$\ ...
- 题解 CF97C 【Winning Strategy】
题解 CF97C [Winning Strategy] 此题是某平台%你赛原题,跟大家分享一下某校zsy和sxr等同学的神仙做法. 我解释一下题意,大是说,我有[无限]个人,每个人可以对他" ...
- mark一下咕掉的题目
蒟蒻才普及组呀~ 大佬别D我 等集中补一下 CF980F:咋说捏,我觉得要联赛了做这题有点浪费时间,等想颓废了再来写写叭qwq 215E/279D/288E/331C3/431D/433E/750G/ ...
- 【POJ1568】【极大极小搜索+alpha-beta剪枝】Find the Winning Move
Description 4x4 tic-tac-toe is played on a board with four rows (numbered 0 to 3 from top to bottom) ...
- poj1568 Find the Winning Move[极大极小搜索+alpha-beta剪枝]
Find the Winning Move Time Limit: 3000MS Memory Limit: 32768K Total Submissions: 1286 Accepted: ...
- codeforces 360 D - Remainders Game
D - Remainders Game Description Today Pari and Arya are playing a game called Remainders. Pari choos ...
- Codeforces 687B. Remainders Game[剩余]
B. Remainders Game time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces 549C. The Game Of Parity[博弈论]
C. The Game Of Parity time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Bots(逆元,递推)
H. Bots time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input out ...
随机推荐
- [翻译] AFDropdownNotification
AFDropdownNotification Dropdown notification view for iOS. 下拉通知的view,用于iOS. Installation - 安装 If you ...
- asp.net Core 使用过滤器判断请求客户端是否为移动端,并实现PC端和移动端请求映射和自动跳转
很多时候我们做网站时单纯的用bootstrap等前端框架实现的前端自适应带给用户的体验并不太好,所以为了提高用户体验会专门针对PC端网页重新设计一套移动端网页,但是怎么才能做到在移动端访问PC页面的时 ...
- (matlab)plot画图的颜色线型(转)
http://wenku.baidu.com/link?url=SVVMVH8QlDIu2hVKDtoBYs6l0CnQvFnFHJJ9yexmYVKQqhz47qIr7aK7LOf8nN0qNdy8 ...
- SDN2017 第一次实验作业
1. 安装mininet 从github上获取Mininet源码并运行安装脚本 $ git clone git://github.com/mininet/mininet $ ./mininet/uti ...
- Spring 源码阅读之BeanFactory
1. BeanFactory 的结构体系如下: 2. XmlBeanFactory ,装载Spring配置信息 package org.springframework.beans.factory.xm ...
- php实现二分查找
<?php class BinSch{ /* * 二分查找,针对顺序表才有用 */ public function search($arr,$k,$low,$high){ if($low< ...
- php操作redis的两个个小脚本
redis这东西,查询起来没有mysql那么方便,只能自己写脚本了.下面是工作中写的两个小脚本 第一个脚本,查找有lottery|的键,将他们全部删除|打印出来 <?php $redis = n ...
- DNS Brand
1) You must add glue records (child nameservers) to your-domain.com from your domain's registrar con ...
- SOJ4453 Excel列数 进制转换
描述 我们都知道Excel的列数是用字母表示的,比如第1列对应A,第27列对应AA. 假设给定一个正整数n,你能给出它所对应的字母表示么? 输入格式 程序需要读入多个测试样例,每个测试样例中: 一个正 ...
- Mysql索引详解及优化(key和index区别)
MySQL索引的概念 索引是一种特殊的文件(InnoDB数据表上的索引是表空间的一个组成部分),它们包含着对数据表里所有记录的引用指针.更通俗的说,数据库索引好比是一本书前面的目录,能加快数据库 ...