HDU 5985 Lucky Coins(概率)】的更多相关文章

题目链接 \(Description\) 有n(n<=10)种硬币,已知每种硬币的数量和它抛一次正面朝上的概率pi.进行如下过程:每次抛一次所有硬币,将正面朝下的硬币去掉.重复该过程直到只剩一种硬币或是没有硬币. 如果结束时还剩下一种硬币,那称它是 \(LuckyCoin\).求每种硬币成为 \(LuckyCoin\) 的概率. \(Solution\) 我们只需要枚举在第j轮,硬币i死亡(这个词形象233),其它硬币在第j轮之前死亡的概率. 由给出的概率及六位小数可以看出,枚举到100轮就很够…
Lucky Coins 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5985 Description Bob has collected a lot of coins in different kinds. He wants to know which kind of coins is lucky. He finds out a lucky kind of coins by the following way. He tosses all th…
http://acm.split.hdu.edu.cn/showproblem.php?pid=5985 题意:有多种类型的硬币,每种类型的硬币都有一定的数量,现在每次抛硬币,除去朝下的硬币,知道最后只剩下一个硬币或者没有硬币,最后的硬币便是幸运硬币,求每种类型硬币成为幸运硬币的概率. 思路: 硬币的概率都是单独的,所以我们只需要计算一个硬币的概率情况即可. 设die[i][k]表示第i种硬币在第k次全部被抛弃的概率,易得,用alive[i][k]表示第i种硬币在第k次至少有一个存活的概率就是$…
题目链接:https://www.nowcoder.com/acm/contest/207/D 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5985 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述 Bob has collected a lot of coins in different kinds. He wants to know which…
题意:给你N种硬币,每种硬币有Si个,有Pi 概率朝上,每次抛所有硬币抛起,所有反面的拿掉,问每种硬币成为最后的lucky硬币的概率. 题解:都知道是概率dp,但是模拟赛时思路非常模糊,很纠结,dp[10][1e6]这个状态让我觉得丝毫没有用,当时一直以为每种硬币是互相独立的.然后中间吃了个饭,回来又想了很久很久,就是不想看题解,然后发现,这个dp和极限有关,同时状态跟走了几步有极大的关系.否则你初始值根本没法赋,那么显然我猜既然保留6位,肯定当数字小到一定程度时是可以忽略的,也就是进行的次数多…
n种硬币各有cnt[i]枚,每轮下其有p[i]概率保留,问各种硬币只有它存活到最后一轮的概率. 设k轮后i硬币存活概率$a[i][k]=(1-p^k_i)^{cnt[i]}$ 则最后只有第i种硬币存活概率为$\sum\limits_{k=1}^{+\infty}{\sum\limits_{j=1,j!=i}^{cnt[i]}{((1-a[i][k])-(1-a[i][k+1])) \times a[j][k-1]}}$ 设k为10000次足够了 /** @Date : 2017-10-06 16…
Lucky Coins Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 608 Accepted Submission(s): 319 Problem Description As we all know,every coin has two sides,with one side facing up and another…
Lucky Coins Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 35 Accepted Submission(s): 29   Problem Description As we all know,every coin has two sides,with one side facing up and another…
HDOJ(HDU).3466 Dividing coins ( DP 01背包 无后效性的理解) 题意分析 要先排序,在做01背包,否则不满足无后效性,为什么呢? 等我理解了再补上. 代码总览 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 505 #define nn 505*100 using namespace std;…
A - Robberies Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2955 Appoint description: Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usu…