【题目链接】

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. ★Java语法(三)——————————变量常量

    变量 1.命名规则:变量是标识符,遵循标识符命名规则: 2.作用范围: a 成员变量:作用范围是整个类: package 课上练习; public class 变量 { ; public static ...

  2. 【MySQL】源码安装

    操作系统:Red Hat Enterprise Linux Server release 6.5 Mysql安装包:mysql-5.6.4-m7.tar.zip,下载地址:http://pan.bai ...

  3. REST、RESTful、SOA

    1.http://www.imooc.com/article/17650 2.SOA面向服务架构

  4. oracle 提示登录密码过期解决

    1.登录到oracle的 服务器 2.切换到oracle 用户 3.设置到当前操作的实例名:export ORACLE_SID=XXX 4.连接数据库的命令行模式:sqlplus /nolog 5.s ...

  5. dubbo之本地存根

    本地存根 远程服务后,客户端通常只剩下接口,而实现全在服务器端,但提供方有些时候想在客户端也执行部分逻辑,比如:做 ThreadLocal 缓存,提前验证参数,调用失败后伪造容错数据等等,此时就需要在 ...

  6. OpenCV:Adaboost训练时数据扩增

    更准确的模型需要更多的数据,对于传统非神经网络机器学习方法,不同的特征需要有各自相符合的数据扩增方法. 1.   在使用opencv_traincascade.exe 过程中,图像读取在 classi ...

  7. 使用GitGUI创建上传本地工程

    参考链接: 使用Git-GUI创建工程 http://jingyan.baidu.com/article/27fa732683ebf546f8271f2e.html 一.刚创建的github版本库,在 ...

  8. Table边框使用总结 ,只显示你要显示的边框

    表格的常用属性 基本属性有:width(宽度).height(高度).border(边框值).cellspacing(表格的内宽,即表格与tr之间的间隔). cellpadding(表格内元素的间隔, ...

  9. POJ_2063_完全背包

    Investment Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10090   Accepted: 3540 Descr ...

  10. Django_文件上传

    使用Django框架实现文件上传功能    upload.html <!DOCTYPE html> <html lang="en"> <head> ...