【题目链接】

http://poj.org/problem?id=3071

【算法】

概率DP

f[i][j]表示第j支队伍进入第i轮的概率,转移比较显然

【代码】

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <cwchar>
#include <cwctype>
#include <stack>
#include <limits.h>
using namespace std; int i,j,k,n,pos;
double a[][],f[][]; int main()
{ while (scanf("%d",&n) != EOF && n != -)
{
memset(f,,sizeof(f));
for (i = ; i <= ( << n); i++)
{
for (j = ; j <= ( << n); j++)
{
scanf("%lf",&a[i][j]);
}
}
for (i = ; i <= ( << n); i++) f[][i] = 1.0;
for (i = ; i <= n + ; i++)
{
for (j = ; j <= ( << n); j++)
{
for (k = ; k <= ( << n); k++)
{
if ((((j - ) >> (i - )) ^ ) == ((k - ) >> (i - )))
f[i][j] += f[i-][k] * f[i-][j] * a[j][k];
}
}
}
pos = ;
for (i = ; i <= ( << n); i++)
{
if (f[n+][i] > f[n+][pos])
pos = i;
}
printf("%d\n",pos);
} return ;
}

【POJ 3071】 Football的更多相关文章

  1. 【POJ 3071】 Football(DP)

    [POJ 3071] Football(DP) Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4350   Accepted ...

  2. bzoj 2295: 【POJ Challenge】我爱你啊

    2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MB Description ftiasch是个十分受女生欢迎的同学,所以 ...

  3. 【链表】BZOJ 2288: 【POJ Challenge】生日礼物

    2288: [POJ Challenge]生日礼物 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 382  Solved: 111[Submit][S ...

  4. BZOJ2288: 【POJ Challenge】生日礼物

    2288: [POJ Challenge]生日礼物 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 284  Solved: 82[Submit][St ...

  5. BZOJ2293: 【POJ Challenge】吉他英雄

    2293: [POJ Challenge]吉他英雄 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 80  Solved: 59[Submit][Stat ...

  6. BZOJ2287: 【POJ Challenge】消失之物

    2287: [POJ Challenge]消失之物 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 254  Solved: 140[Submit][S ...

  7. BZOJ2295: 【POJ Challenge】我爱你啊

    2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 126  Solved: 90[Submit][Sta ...

  8. BZOJ2296: 【POJ Challenge】随机种子

    2296: [POJ Challenge]随机种子 Time Limit: 1 Sec  Memory Limit: 128 MBSec  Special JudgeSubmit: 114  Solv ...

  9. BZOJ2292: 【POJ Challenge 】永远挑战

    2292: [POJ Challenge ]永远挑战 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 513  Solved: 201[Submit][ ...

随机推荐

  1. css3中的box-sizing属性的使用

    box-sizing属性用来定义元素的width和height所表示的区域,该属性一般有三种值:content-box.border-box.inherit. 其中inherit表示box-sizin ...

  2. 关于AS使用git的那些奇葩事儿

    首先致谢: http://blog.csdn.net/a10615/article/details/52135617, 我们不生产代码, 我们只做大自然的搬运工! 总结 1. 首次无法push问题: ...

  3. 如何使用SQL Developer创建数据库连接

    SQL Develope启动后,需要创建一个数据库连接,只有创建了数据库连接,才能在该数据库的方案中创建.更改对象或编辑表中的数据. 创建数据库连接的步骤如下. (1)在主界面左边窗口的“连接”选项卡 ...

  4. jupyter notebook主目录修改

    转自http://blog.csdn.net/c437yuyang/article/details/54836303 1.打开 cmd 输入命令 jupyter notebook --generate ...

  5. softmax回归---sigmoid(1)

    介绍softmax之前先讲讲sigmoid: 逻辑回归模型常用的函数:sigmoid函数(用来做二分类) 表达式:f(x)=L/(1+exp-k(x-x0)) 其图像: 本质:将一个真值映射到(0,1 ...

  6. 设置快捷键用sublime直接打开浏览器

    1.安装sidebarenhancements插件 ctrl+shift+p —> Install Package —> 找到SideBarEnhancements 2.配置预览快捷键 / ...

  7. [luogu1129 ZJOI2007] 矩阵游戏 (二分图最大匹配)

    传送门 Description Input Output Sample Input 2 2 0 0 0 1 3 0 0 1 0 1 0 1 0 0 Sample Output No Yes HINT ...

  8. 55.TF/IDF算法

    主要知识点: TF/IDF算法介绍 查看es计算_source的过程及各词条的分数 查看一个document是如何被匹配到的         一.算法介绍 relevance score算法,简单来说 ...

  9. laravel Job 和事件

    在做项目的时候,一直对Job和Event有个疑惑.感觉两者是相同的东西,搞不清楚两者的区别在哪里!经过一段时间的琢磨和查找了相关的资料,对Job和Event做了一些总结,以便记忆. Job Job既可 ...

  10. 在UEditor编辑器的工具栏上加一行文字

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...