poj 3071 Football 概率dp
来源:互联网 发布:淘宝积分抽奖在哪里 编辑:程序博客网 时间:2024/04/28 15:28
这道题看如果能想到dp[i][j]表示i表示第i次比赛,j队硬的概率 就一定能做出来了,在看解题报告也没有用了,这道题解题报告说不明白,代码也毫无可读性,所以还是硬憋吧!
#include<iostream>#include<cstdio>#include<memory.h>using namespace std;double map[200][200];double dp[9][200];int main(){// freopen("in.txt","r",stdin); int n; while(~scanf("%d",&n),n!=-1){ int te=1<<n; for(int i=1;i<=te;i++){ for(int j=1;j<=te;j++) scanf("%lf",&map[i][j]); } memset(dp,0,sizeof(dp)); for(int i=0;i<te+1;i++) dp[0][i]=1.0; for(int i=1;i<=n;i++){ for(int k=1<<i;k<=1<<n;k+=1<<i){ for(int q=k-(1<<i)+1;q<=k-(1<<i)+(1<<(i-1));q++){ for(int p=k-(1<<(i-1))+1;p<=k;p++) dp[i][q]+=map[q][p]*dp[i-1][q]*dp[i-1][p]; } for(int p=k-(1<<(i-1))+1;p<=k;p++){ for(int q=k-(1<<i)+1;q<=k-(1<<i)+(1<<(i-1));q++) dp[i][p]+=map[p][q]*dp[i-1][p]*dp[i-1][q]; } } } int ans;double temp=-1; for(int i=1;i<=te;i++){ if(dp[n][i]-temp>=0.0000001) { ans=i; temp=dp[n][i]; } } printf("%d\n",ans); }}
- poj 3071 Football 概率dp
- POJ 3071 Football 概率DP
- poj 3071 football 概率dp
- poj 3071 Football(概率dp)
- POJ 3071 Football (概率DP)
- poj 3071 Football 概率dp
- Football - POJ 3071 概率dp
- POJ 3071 Football 概率dp
- POJ 3071 Football 概率DP
- POJ 3071 Football 概率dp
- POJ 3071 Football (概率DP)
- poj 3071 Football 概率dp
- POJ 3071 Football(概率DP)
- POJ 3071 Football 【概率DP】
- POJ 3071 Football(概率DP)
- POJ 3071 Football [概率DP]
- POJ 3071 Football【概率DP】
- POJ 3071 Football (概率DP)
- 六:线帽
- webbuilder 平台学习心得
- 第九周上级任务--个人所得税计算器
- 烟花烫的伤感凄美日志发布:我一直想对你说的八句话
- opencv的视频分辨率设定问题
- poj 3071 Football 概率dp
- 难过了,不要告诉别人。自己知道就好:伤感
- weblogic错误处理
- 数学一元二次方程之检验器.........
- ural 1928 Another ecology problem 博弈dp
- 乒乓球技巧
- 我知道,没有人会在意我的一切
- 大型机笔记:作业的六个阶段
- sicily 1150. 简单魔板 & 1151. 魔板