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 ...
随机推荐
- [翻译] TransitionKit
TransitionKit https://github.com/blakewatters/TransitionKit A simple, elegantly designed block based ...
- jiekou
接口 新的接口 package cn.eangaie.jingdong.controller; import cn.eangaie.jingdong.entity.Result; import c ...
- 在C#应用程序中,利用表值参数过滤重复,批量向数据库导入数据,并且返回重复数据
在很多情况下,应用程序都需要实现excel数据导入功能,数据如果只有几十条,或上百条,甚至上千条,速度还好. 但是不仅如此,如果客户提供给你的excel本身存在着重复数据,或是excel中的某些数据已 ...
- python SQLAlchemy复习
下面的代码主要使用SQLAlchemy的ORM思想实现查询单词的功能: 实现输入一个单词,查询出与输入单词接近的单词以及单词的意思. 主要有以下三步: 1.创建数据表 2.插入数据 3.查询数据 1. ...
- ascii2native 转码 解码
//把十六进制的编码转为原码function asciiHex2native(strAscii) { var output = ""; var posFrom = 0; var p ...
- 理解JVM——类加载机制
我们在编写Java程序之后,会通过编译器得到一个class文件,这个class文件是如何与JVM进行配合的呢?类中的信息是如何变成JVM可以使用的Java类型呢?这些都是类加载机制做到的. 虚拟机把描 ...
- C++——命名空间
C++命名空间基本常识 所谓namespace,是指标识符的各种可见范围.C++标准程序库中的所有标识符都被定义于一个名为std的namespace中. 一 :<iostream>和< ...
- VMware虚拟机更换根用户( su: Authentication failure问题)
su命令不能切换root,提示su: Authentication failure,只要你sudo passwd root过一次之后,下次再su的时候只要输入密码就可以成功登录了.
- 罗技 HTPC K700
1.下方的 播放,暂停 快进 可以控制midea 2.CTRL+ALT+FN+(PG UP)可开启触控板左键点击功能3.FN(功能键)+左键=右键功能
- 【git3】git+Gogs+webStorm的使用
Gogs:相比gitlab更轻量级,基于golang的搭建自助 Git 服务.使用Gogs轻松搭建可能比GitLab更好用的Git服务平台. 参考资料:http://blog.csdn.net/u01 ...