POJ3071 Football 概率DP 简单
http://poj.org/problem?id=3071
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
const int maxn=;
const double eps=1e-;
const int modn=;
int n;
double a[<<][<<]={};
double f[<<][]={};
int main(){
while(scanf("%d",&n)){
if(n==-)return ;
memset(f,,sizeof(f));memset(a,,sizeof(a));
int z=<<n;
for(int i=;i<=z;i++){
for(int j=;j<=z;j++){
scanf("%lf",&a[i][j]);
}
}
for(int i=;i<=z;i++){f[i][]=;}
for(int i=;i<=n;i++){
for(int j=;j<=z;j++){
int t=(j-)/(<<i);
t=t*(<<i); t+=(<<(i-))+;
if(t<=j)t=t-(<<(i-));
int en=t+(<<(i-))-;
for(int w=t;w<=en;w++){
f[j][i]+=a[j][w]*f[w][i-]*f[j][i-];
}
}
}double ans=0.0;int id=;
for(int i=;i<=z;i++){
if(f[i][n]>ans){
ans=f[i][n];
id=i;
}
}printf("%d\n",id);
}
return ;
}
POJ3071 Football 概率DP 简单的更多相关文章
- POJ3071:Football(概率DP)
Description Consider a single-elimination football tournament involving 2n teams, denoted 1, 2, …, 2 ...
- [poj3071]football概率dp
题意:n支队伍两两进行比赛,求最有可能获得冠军的队伍. 解题关键:概率dp,转移方程:$dp[i][j] + = dp[i][j]*dp[i][k]*p[j][k]$表示第$i$回合$j$获胜的概率 ...
- Football 概率DP poj3071
Footbal ...
- poj 3071 Football (概率DP水题)
G - Football Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit ...
- poj3071之概率DP
Football Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2667 Accepted: 1361 Descript ...
- POJ 3071 Football(概率DP)
题目链接 不1Y都对不住看过那么多年的球.dp[i][j]表示i队进入第j轮的概率,此题用0-1<<n表示非常方便. #include <cstdio> #include &l ...
- HDU 3853 期望概率DP
期望概率DP简单题 从[1,1]点走到[r,c]点,每走一步的代价为2 给出每一个点走相邻位置的概率,共3中方向,不动: [x,y]->[x][y]=p[x][y][0] , 右移:[x][y ...
- 2018.09.01 poj3071Football(概率dp+二进制找规律)
传送门 概率dp简单题. 设f[i][j]表示前i轮j获胜的概率. 如果j,k能够刚好在第i轮相遇,找规律可以发现j,k满足: (j−1)>>(i−1)" role=" ...
- poj3071 Football(概率dp)
poj3071 Football 题意:有2^n支球队比赛,每次和相邻的球队踢,两两淘汰,给定任意两支球队相互踢赢的概率,求最后哪只球队最可能夺冠. 我们可以十分显然(大雾)地列出转移方程(设$f[ ...
随机推荐
- 数据库-SQLite
技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http://weibo.com/luohanchenyilong 数据库-SQLite 技术博客http:// ...
- BestCoder Round92
题目链接:传送门 HDU 6015-6018 解题报告:传送门 HDU6015 Skip the Class Accepts: 678 Submissions: 1285 Time Limit: ...
- 简单漂亮的php验证码函数
/* *说明:函数功能是生成验证码 * 参数说明:输入 长度,宽度,高度 */ function vcode($_code_length = , $_width = , $_height = ){ $ ...
- Ajax请求数据与删除数据后刷新页面
1.ajax异步请求数据后填入模态框 请求数据的按钮(HTML) <a class="queryA" href="javascript:void(0)" ...
- Machine Learning系列--TF-IDF模型的概率解释
信息检索概述 信息检索是当前应用十分广泛的一种技术,论文检索.搜索引擎都属于信息检索的范畴.通常,人们把信息检索问题抽象为:在文档集合D上,对于由关键词w[1] ... w[k]组成的查询串q,返回一 ...
- python ORM - sqlalchemy 操作使用
python操作数据库 使用 ORM - sqlalchemy,pymsql 安装: pip install pymsq pip install sqlalchemy 一. '''连接数据库''' ...
- Web开发:URL编码与解码
通常如果一样东西需要编码,说明这样东西并不适合传输.原因多种多样,如Size过大,包含隐私数据,对于Url来说,之所以要进行编码,是因为Url中有些字符会引起歧义. 例如Url参数字符串中使用key= ...
- 百度地图sdk定位和遇到的坑
封装定位服务类: import android.content.Context; import com.baidu.location.BDAbstractLocationListener; impor ...
- day2 购物商城
购物商城 商品展示.价格 买,加入购物车 付款,钱不够.(减商品,充值)
- day4迭代器&生成器&正则表达式
一.迭代器 迭代器是访问集合元素的一种方式.迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束.迭代器只能往前不能后退,不过这也没什么,因为人们很少在迭代途中后退.另外,迭代器的一大优点 ...