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 ...
随机推荐
- 转:动态table分页(ORCALE)
前端:<table style="width: 100%;"> <tr> <td> 搜索字: <asp:TextBox ID=" ...
- GONMarkupParser的使用
GONMarkupParser的使用 说明 这是一个写得非常好的富文本工具类,便于你进行简易的封装.本人抛砖引玉,只进行了少量的简化使用封装. 效果 源码 https://github.com/nic ...
- Linux dumpe2fs命令详解
dumpe2fs: 查看格式化之后的文件系统信息. dumpe2fs使用 [root@localhost omc]# dumpe2fs --help<BR>dumpe2fs 1.41.12 ...
- Promise & Deferred Objects in JavaScript Pt.2: in Practice
原文:http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt2-practical-use Intr ...
- 【译文】MySQL InnoDB 使用的锁分析
InnoDB 使用的 锁类型 共享锁和排它锁 意向锁 记录锁 间隙锁 Next-key 锁 插入意向锁 AUTO-INC 锁 共享锁和排他锁 InnoDB实现了俩个标准的行级锁,共享锁和排它锁. 共享 ...
- swift的Hashable
Conforming to the Hashable Protocol To use your own custom type in a set or as the key type of a dic ...
- P4197 Peaks
题目描述 在Bytemountains有N座山峰,每座山峰有他的高度\(h_i\).有些山峰之间有双向道路相连,共M条路径,每条路径有一个困难值,这个值越大表示越难走,现在有Q组询问,每组询问询问从点 ...
- 【JavaScript】赛码网前端笔试本地环境搭建
参考:https://hoofoo.me/article/2017-04-11/%E8%B5%9B%E7%A0%81%E7%BD%91%E5%89%8D%E7%AB%AF%E7%AC%94%E8%AF ...
- Ubuntu16.04如何彻底删除Apache2
虽然作为运维人员通常情况不建议随意删除Linux系统上面的任何软件,主要指生产环境下,测试环境也不能太随意. 但是有的时候,比如系统环境要变一变,我们就需要替换一些淘汰的软件,对此我们一般都会删除. ...
- js对LocalDateTime时间的格式化成yyyy-MM-dd HH:mm:ss
formatter: function(value,row,index){ var arr = value; if(arr==null || arr==""){ return &q ...