成环的概率dp(初级) zoj 3329】的更多相关文章

原题地址:https://vjudge.net/problem/ZOJ-3329 题目大意: 有三个骰子,分别有k1,k2,k3个面,初始分数是0.第i骰子上的分数从1道ki.当掷三个骰子的点数分别为a,b,c的时候,分数清零,否则分数加上三个骰子的点数和,当分数>n的时候结束.求需要掷骰子的次数的期望. (0<=n<= 500,1<K1,K2,K3<=6,1<=a<=K1,1<=b<=K2,1<=c<=K3) 思路: 如果设当前分数为 i…
poj 2096 题目:http://poj.org/problem?id=2096 f[ i ][ j ] 表示收集了 i 个 n 的那个. j 个 s 的那个的期望步数. #include<cstdio> #include<cstring> #include<algorithm> #define db double using namespace std; ; db n,s,f[N][N]; int main() { scanf("%lf%lf"…
ZOJ Problem Set - 3822 Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a lar…
题目链接 参考博客:http://blog.csdn.net/napoleon_acm/article/details/40020297 题意:给定n*m的空棋盘 每一次在上面选择一个空的位置放置一枚棋子,直至每一行每一列都至少有一个棋子,求放置次数的期望 分析: dp[i][j][k] 表示当前用了<=k个chess ,覆盖了i行j列(i*j的格子 每行至少一个,每列至少一个)的概率. dp[i][j][k] 由 dp[i][j][k-1] , dp[i-1][j][k-1], dp[i][j…
记忆化搜索+概率DP 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #define ll __int64 #define pi acos(-1.0) #define MAX 50000 using names…
题目链接:problemId=5376">http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5376 Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative ch…
Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboar…
Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboar…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5376 题意:每天往n*m的棋盘上放一颗棋子,求多少天能将棋盘的每行每列都至少有一颗棋子的期望 分析: 我们来分析一波: 讲解一下弱弱的我的解题思路 (1)首先可以想到的是设一个 dp[val]  表示 当前用了val 个旗子距离目标状态还有几天的概率.但是我们可以发现单纯的一个状态val 是不能表示出准确的状态 , 比如说现在只是知道了我使用了多少的旗子,当前不知道有多少行和…
专题链接 第一题--poj3744 Scout YYF I  链接 (简单题) 算是递推题 如果直接推的话 会TLE 会发现 在两个长距离陷阱中间 很长一部分都是重复的 我用 a表示到达i-2步的概率 b表示到达i-1步的概率 c表示到达i步的概率 如果数很大的话 中间肯定会有重复的a,b,c 直接将i挪到最近的陷阱前一位 i = a[o]-1,大大节省时间. #include <iostream> #include<cstdio> #include<cstring>…