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. amazon RequestReport

    _GET_SELLER_FEEDBACK_DATA_        MarketplaceIdList 这此字段必填,否则无法取到报告

  2. Oracle 内核参数

    安装Oracle的时候,可以参考Oracle 的安装文档,来设置相关内核参数的值,但是有些参数的值还是需要根据我们自己的情况来进行调整.注:不同系统的参数不同,本篇针对linux. 一.Linux 系 ...

  3. SSH-KEY服务及批量分发与管理实战

    SSH服务 一.SSH服务介绍 SSH是Secure Shell Protocol的简写,由IETF网络工作小组制定:在进行数据传输之前,SSH先对联机数据包通过加密技术进行加密处理,加密后再进行数据 ...

  4. ASP.NET 页面传值得9种方式

    1. Get(即使用QueryString显式传递)     方式:在url后面跟参数.     特点:简单.方便.     缺点:字符串长度最长为255个字符:数据泄漏在url中.     适用数据 ...

  5. Thinkphp C方法

    C方法是ThinkPHP用于设置.获取,以及保存配置参数的方法,使用频率较高. 了解C方法需要首先了解下ThinkPHP的配置,因为C方法的所有操作都是围绕配置相关的.ThinkPHP的配置文件采用P ...

  6. Oracle外部表的使用

    外部表可以像其它表一样,用select语句作查询.但不能做DML操作,不能建index,不接受约束.这是因为它不是以段的形式存于数据库中,只是以数据字典构造存在,指向一个或多个操作系统文件. 外部表的 ...

  7. 【IOS】利用ASIHTTPRequest 实现一个简单的登陆验证

    http://blog.csdn.net/toss156/article/details/7638529

  8. Spring的配置文件

    Web.xml将会配置Spring的配置文件位置: <servlet>        <servlet-name>x</servlet-name>        & ...

  9. 团体程序设计天梯赛-练习集L2-003. 月饼

    L2-003. 月饼 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不 ...

  10. hdu 3952

    因为一个小错 不过  好不爽........ #include <iostream> #include <fstream> using namespace std; struc ...