NBA Finals
Time Limit: 1000 ms   Case Time Limit: 1000 ms   Memory Limit: 64 MB
Total Submission: 251   Submission Accepted: 41
 
Description
Consider two teams, Lakers and Celtics, playing a series of NBA Finals until one of the teams wins n games. Assume that the probability of Lakers winning a game is the same for each game and equal to p and the probability of Lakers losing a game is q = 1-p. Hence, there are no ties.Please find the probability of Lakers winning the NBA Finals if the probability of it winning a game is p.
Input
1st line: the game number (7<=n<=165) the winner played. 
2nd line: the probability of Lakers winning a game p (0<p<1).
Output
1st line: The probability of Lakers winning the NBA Finals.
Round the result to 6 digits after the decimal point and keep trailing zeros.
Sample Input

7
0.4

Sample Output

0.22884

4

概率DP

一样的题、swustoj 649

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
#define N 210 int main()
{
int n;
double p;
double dp[N][N];
while(scanf("%d%lf",&n,&p)!=EOF)
{
memset(dp,,sizeof(dp));
for(int i=;i<=n;i++) dp[][i]=;
for(int i=;i<=n;i++){
for(int j=;j<=n;j++){
dp[i][j]=dp[i-][j]*p+dp[i][j-]*(-p);
}
}
printf("%.6f\n",dp[n][n]);
}
return ;
}

[ahu 1248] NBA Finals的更多相关文章

  1. SWUST OJ NBA Finals(0649)

    NBA Finals(0649) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 404 Accepted: 128   Descri ...

  2. [Swust OJ 649]--NBA Finals(dp,后台略(hen)坑)

    题目链接:http://acm.swust.edu.cn/problem/649/ Time limit(ms): 1000 Memory limit(kb): 65535 Consider two ...

  3. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

  4. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  5. 寒冰王座 hdu 1248(背包)

    http://acm.hdu.edu.cn/showproblem.php?pid=1248 #include <stdio.h> #include <stdlib.h> #i ...

  6. 见证历史 -- 2013 NBA 热火夺冠之路有感

    见证历史-- 2013 NBA 热火夺冠之路有感今年NBA季后赛从第一轮看起,到最终的热火夺冠,应该看得是最爽的一次.但一些情节和细节,回忆起来,深有感悟. 1. 做人要低调詹宁斯豪言演黑八雄鹿本赛季 ...

  7. JavaScript案例六:简单省市联动(NBA版)

    JavaScript实现简单省市(NBA版)联动 <!DOCTYPE html> <html> <head> <title>JavaScript实现简单 ...

  8. ACM - ICPC World Finals 2013 F Low Power

    原题下载:http://icpc.baylor.edu/download/worldfinals/problems/icpc2013.pdf 题目翻译: 问题描述 有n个机器,每个机器有2个芯片,每个 ...

  9. Codeforces Round #342 (Div. 2) D. Finals in arithmetic 贪心

    D. Finals in arithmetic 题目连接: http://www.codeforces.com/contest/625/problem/D Description Vitya is s ...

随机推荐

  1. K2 Blackpearl 4.6.8 安装步骤详解

    由于某些原因,我幼小的心灵受到了很大的创伤,倍感世态之炎凉,久久不能愈合,也因此很久没再接触K2 Blackpearl了.偶然来了兴趣,想整个K2的环境,闲暇之余了解其新功能,温故知新,也希望从中能讨 ...

  2. 【学习总结】OS X , IOS , IOS SDK , XCode之间的关系

    几个基本的概念 : OS X : 属于桌面PC级别(IMac,MacPro等)对应安装的操作系统 IOS : 属于移动设备级别(Iphone,Ipad等)对应安装的操作系统 XCode: 是一个IDE ...

  3. tableView中不易被注意到的方法

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ } 这个方法 在 r ...

  4. 你所不知道的ref

    在c#中有个关键字叫ref,它的作用是使参数按引用传递,基本用法如下: class RefExample { static void Method(ref int i) { i = ; } stati ...

  5. 基于Ogre的DeferredShading(延迟渲染)的实现以及应用

    http://blog.sina.com.cn/s/blog_458f871201017i06.html 这篇文章写的不错,从比较宏观的角度说了下作者在OGRE中实现的延迟渲染

  6. linux下nginx的安装

    一.安装nginx     1.在nginx官方网站下载一个包,下载地址是:http://nginx.org/en/download.html     2.WinSCP(ftp上传工具).exe FT ...

  7. GIS的数学基础

    在这里需要说明一点,任何领域的概念.技术都有其特定的适用范围,有其解决的问题,有其发展的历史,所以,抛开应用环境.范围来谈技术就像是没有根系的枝丫,枝丫再粗壮也只是一根木头而已. 那接下来我们来聊聊什 ...

  8. c++ 发布动态.so

    原文地址 代码改变世界 Posts - 105, Articles - 0, Comments - 1561 Cnblogs Dashboard Logout Home Contact Gallery ...

  9. Nginx 禁止访问某个目录或文件的设置方法

    如果基于WEB根目录下,要禁止用户访问/config目录,或者要禁止用户访问/config.ini(ZF常用INI,不过建议还是放到WEB目录以外的地方),可以通过location进行配置,返回403 ...

  10. ASP.NET MVC 数据分页思想及解决方案代码

    作为一个程序猿,数据分页是每个人都会遇到的问题.解决方案更是琳琅满目,花样百出.但基本的思想都是差不多的. 下面给大家分享一个简单的分页器,让初学者了解一下最简单的分页思想,以及在ASP.NET MV ...