ZOJ 3822 Domination (三维概率DP)】的更多相关文章

E - Domination Time Limit:8000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu Submit Status Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he…
题目链接:zoj 3822 Domination 题目大意:给定一个N∗M的棋盘,每次任选一个位置放置一枚棋子,直到每行每列上都至少有一枚棋子,问放置棋子个数的期望. 解题思路:大白书上概率那一张有一道类似的题目,可是由于时间比較久了,还是略微想了一下. dp[i][j][k]表示i行j列上均有至少一枚棋子,而且消耗k步的概率(k≤i∗j),由于放置在i+1~n上等价与放在i+1行上,同理列也是如此.所以有转移方程: dp[i][j][k+1]+=dp[i][j][k]∗(n−k)(S−k) d…
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://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…
题目链接: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 题目链接:https://odzkskevi.qnssl.com/9713ae1d3ff2cc043442f25e9a86814c?v=1531624384 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…
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…
3799567 2014-10-14 10:13:59                                                                     Accepted                                                             3822 C++ 1870 71760 njczy2010 3799566 2014-10-14 10:13:25                            …
一个n行m列的棋盘,每天可以放一个棋子,问要使得棋盘的每行每列都至少有一个棋子 需要的放棋子天数的期望. dp[i][j][k]表示用了k天棋子共能占领棋盘的i行j列的概率. 他的放置策略是,每放一次,就会有四种可能 1)增加一行一列 2)增加一行 3)增加一列 4)不变 所以他放置的概率就可以求出来,每次放下的概率就是当前能放的点除以总的空的点数. 最后统计期望的时候需要统计在第k天刚好符合占满n行m列的概率,就是dp[i][j][k]-dp[i][j][k-1] #include <cstd…
题意: 给N×M的棋盘.每天随机找一个没放过棋子的格子放一个棋子 问使得每一个每列都有棋子的天数期望 思路: dp[i][j][k] 代表放了i个棋子占了j行k列 到达目标状态的期望 然后从 dp[n*m][n][m] 往后递推就好了. 由于知道了有i个棋子 比如一个状态dp[6][3][3] x x x o o o x o o o o o x o x o o o o o o o o o 对于 dp[i+1][3][3] 事实上就是3*3剩下的空再放一个,概率就是(j*k-i) / (n*m-i…
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: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3822 Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends.…
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 chessboard with N rows and M columns. Every day after work, Edward will place a chess piec…
Description 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 chessboard with N rows and M columns. Every day after work, Edward will place…
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…
题意: 一个棋盘假设每行每列都有棋子那么这个棋盘达到目标状态  如今随机放棋子  问达到目标状态的期望步数 思路: 用概率来做  计算第k步达到目标状态的概率  进而求期望  概率计算方法就是dp  dp[k][i][j]表示第k步有i行被覆盖j列被覆盖  转移仅仅有4种  -- 同一时候覆盖行列  覆盖行  覆盖列  不覆盖  状态数50^4  非常easy 代码: #include<cstdio> #include<iostream> #include<cstring&g…
One Person Game Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 has K1 faces. Die2 has K2 faces. Die3 has K3 faces. All the…
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://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5376 题意:每天往n*m的棋盘上放一颗棋子,求多少天能将棋盘的每行每列都至少有一颗棋子的期望 分析: 我们来分析一波: 讲解一下弱弱的我的解题思路 (1)首先可以想到的是设一个 dp[val]  表示 当前用了val 个旗子距离目标状态还有几天的概率.但是我们可以发现单纯的一个状态val 是不能表示出准确的状态 , 比如说现在只是知道了我使用了多少的旗子,当前不知道有多少行和…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3822 本场比赛之前,我记得.见WALK概率路DP称号.那么它应该是可以考虑的概率DP,十一还特意看了碍着, 当场景.真的OUT了.然后好激动的样子,開始推得二维.然后感觉好难推.发现n仅仅有50.所以就去推三维,然后发现k<max(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…
///dp[i][j][k]代表i行j列件,并把一k的概率 ///dp[i][j][k]一种常见的方法有四种传输 ///1:dp[i-1][j][k-1] 可能 (n-(i-1))*j/(n*m-(k-1)) ///2:dp[i][j-1][k-1] 概率为 i*(m-(j-1))/(n*m-(k-1)) ///3:dp[i-1][j-1][k-1] 概率为 (n-(i-1))*(m-(j-1))/(n*m-(k-1)) ///4:dp[i][j][k-1] 概率为 (i*j-(k-1))/(n…
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…
概率类题目一直比较弱,准备把kuangbin大师傅总结的这篇题刷一下! 我把下面的代码换成了自己的代码! 原文地址:http://www.cnblogs.com/kuangbin/archive/2012/10/02/2710606.html *************************************************************** 概率DP主要用于求解期望.概率等题目. 转移方程有时候比较灵活. 一般求概率是正推,求期望是逆推.通过题目可以体会到这点. 首先…
概率DP,还是有点恶心的哈,这道题目真是绕,问你T个队伍.m个题目.每一个队伍做出哪道题的概率都给了.冠军队伍至少也解除n道题目,全部队伍都要出题,问你概率为多少? 一開始感觉是个二维的,然后推啊推啊没有推出来,一開始觉得冠军队伍仅仅能有一个.所以必须控制一个队伍解题数比其他队伍多,并且这个冠军队伍解题数必须大于等于n.大于n的时候其他队伍解题数就非常难了,直到坑到最后才发现 原来能够非常多队伍都是冠军,大家都是十道 那么大家都是冠军.---- 然后还是继续推二维,结果还是没想出.看来不是先如果…
传送门 概率dp经典题目. 直接f[i][j][k]f[i][j][k]f[i][j][k]表示当前是第i次挑战,已经胜利了j次,目前的背包剩余空间是k. 然后用前面的转移后面的就行了. 注意第三维可能是负数,需要用一些技巧转化一下(比如把整个数组的下标向右平移) 代码: #include<bits/stdc++.h> #define N 205 using namespace std; int n,l,K,a[N],tmp; double p[N],f[2][205][605],ans; i…
LOOPS Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 8453    Accepted Submission(s): 3397 Problem Description Akemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl). Homura wants to help h…
NOIP2016D1T3 换教室 题目大意:有n个时间段,每个时间段i有两个教室a[i],b[i]可以上课,如果不申请换教室就在教室a[i]上课,如果换教室就在b[i]上课.你最多只能换m次教室.教室之间有一些双向路,保证教室两两可以到达.问上完n节课走路长度的数学期望. 题解:这是一道典型的概率dp题.重要的是状态的设计. 我们令dp[i][j][0/1]代表:第i个时间段换了j次课室这次换(0)还是不换(1)的数学期望.需要注意的是因为要满足dp的无后效性,必须要加上dp状态的第三维代表这一…
/* 大连热身D题 题意: 有n个人,m个浴室每个浴室有ai个喷头,每个人等概率得选择一个浴室. 每个浴室的人都在喷头前边排队,而且每个浴室内保证大家都尽可能均匀得在喷头后边排队. 求所有浴室中最长队伍的期望. 思路: 概率dp dp[i][j][k]代表前i个浴室有j个人最长队伍是k的概率. 枚举第i个浴室的人数.然后转移的时候其实是一个二项分布. */ #include<bits/stdc++.h> using namespace std; ]; ][][]; ][]; void init…