[ahu 1248] NBA Finals

时间:2021-10-01 04:05:24
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&lpar;0649&rpar;

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

  2. &lbrack;Swust OJ 649&rsqb;--NBA Finals&lpar;dp&comma;后台略&lpar;hen&rpar;坑&rpar;

    题目链接: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&lpar;背包&rpar;

    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案例六:简单省市联动&lpar;NBA版&rpar;

    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 &num;342 &lpar;Div&period; 2&rpar; D&period; Finals in arithmetic 贪心

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

随机推荐

  1. bitmap格式分析(转)

    源:bitmap格式分析 参考:bitmap图像介绍 最近正在着手开发一个图片库,也就是实现对常见图片格式的度写操作.作为总结与积累,我会把这些图片格式以及加载的实现写在我的Blog上. 说到图片,位 ...

  2. 10&period; Regular Expression Matching &lpar;JAVA&rpar;

    Given an input string (s) and a pattern (p), implement regular expression matching with support for ...

  3. Spring 如何保证后置处理器的执行顺序 - OrderComparator

    Spring 如何保证后置处理器的执行顺序 - OrderComparator Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.htm ...

  4. 【调试】Core Dump是什么?Linux下如何正确永久开启?

    [调试]Core Dump是什么?Linux下如何正确永久开启?

  5. level 1 -- unit 4 -- where 引导的疑问句

    where be sb/sth 询问地点,用where where is the restaurant? where are my socks ? where was tome just now? w ...

  6. bzoj 3676 &lbrack;Apio2014&rsqb;回文串(Manacher&plus;SAM)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3676 [题意] 给定一个字符串,定义一个串的权值为长度*出现次数,求最大权的回文子串. ...

  7. windows中使用mysql配置my&period;ini时的坑

    windows中安装mysql的一般步骤: mysql版本:5.7.16 1.解压 2.把解压的文件夹bin目录地址添加到环境变量PATH里面 3.在文件加中添加配置文件my.ini——配置内容后面说 ...

  8. python 的简单抓取图片

    在我们日常上网浏览网页的时候,经常会看到一些好看的图片,我们就希望把这些图片保存下载,或者用户用来做桌面壁纸,或者用来做设计的素材. 我们最常规的做法就是通过鼠标右键,选择另存为.但有些图片鼠标右键的 ...

  9. Regexp-Utils:身份证号校验

    ylbtech-Regexp-Utils:身份证号校验 1.返回顶部 1.方法 var idCardNoUtil = { /*省,直辖市代码表*/ provinceAndCitys: { 11: &q ...

  10. 用ksh运行一个helloworld

    本文目的在于记录和回顾.不建议当教程. Linux上没有ksh的话yum install ksh就可以了 直接上图 vim一个文件后缀名是ksh 内容是和shell差不多 然后赋予这个文件可执行权限 ...