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. 使用OpenXml操作Excel,以下方法用于在添加列时修改Cell的CellReference属性。

    以下方法实现了递增Excel中单元格的CellReference的功能,只支持两位字母. public static string CellReferenceIncrement(string cell ...

  2. 【转】O'Reilly Java系列书籍建议阅读顺序(转自蔡学庸)

    Learning Java the O'Reilly's Way (Part I) Java 技术可以说是越来越重要了,不但可以用在计算机上,甚至连电视等家电用品,行动电话.个人数字助理(PDA)等电 ...

  3. 分享自lordinloft 《[转载]COMPILE_OPT 的用法介绍》

    来源:http://blog.sina.com.cn/s/blog_63180b75010117oj.html#bsh-73-372143085

  4. X86 复制本地 生成有问题、类型初始值设定项引发异常

    一. 选择项目,右击属性——生成——目标平台 选择x86就可以了. 二. 有的时候你发现你项目中的dll没有生成到本地bin,这时右击它属性,到它引用的地方复制引用dll放到部署环境中,你会发现一样报 ...

  5. swift基础--变量

    (1)变量与常量 (2)基本类型 (3)强制转换 (4)Bool类型 (5)元组 (6)可选值 //变量和常量 var str = "Hello, playground" let  ...

  6. 第三方登录过程—OAuth2.0协议

    ---恢复内容开始--- 理清思路 1.在第三方注册成为开发者,拿到第三方给的client_id(app_id---就像你的身份证.QQ号)和client_secret(就像你的QQ密码): 2.填写 ...

  7. Linux的安装 CentOS-7.1

    说明: 首先,版本:7.1版:CentOS-7-x86_64-Everything-1503-01.iso 下载自:http://mirrors.163.com/centos/7/isos/x86_6 ...

  8. 应该如何入门deep learning呢?从UFLDL开始!

    抱歉,大家,这里不是要分享如何学习deep learning,而是想要记录自己学习deep learning的小历程,算是给自己的一点小动力吧,希望各位业内前辈能够多多指教! 看到有网友提到,Andr ...

  9. linux mysql添加用户

    格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码" 例1.增加一个用户user_1密码为123,让他可以在任何主机上登录 ...

  10. 李洪强iOS开发之OC常见错误汇总

    // //  main.m //  16 - 常见错误汇总 // //  Created by vic fan on 16/7/13. //  Copyright © 2016年 李洪强. All r ...