Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8903   Accepted: 3772 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually exp…
题目链接: http://poj.org/problem?id=2151 Check the difficulty of problems Time Limit: 2000MSMemory Limit: 65536K 问题描述 Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contes…
以前做过的题目了....补集+DP        Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4091   Accepted: 1811 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult,…
Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5457   Accepted: 2400 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually exp…
Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4522   Accepted: 1993 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually exp…
Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4748   Accepted: 2078 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually exp…
Check the difficulty of problems Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5830 Accepted: 2542 Description Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect…
题目链接:http://poj.org/problem?id=2151 题意: 一次ACM比赛,有t支队伍,比赛共m道题. 第i支队伍做出第j道题的概率为p[i][j]. 问你所有队伍都至少做出一道,并且有队伍做出至少n道的概率. 题解: 关于[至少]问题的表示. 对于每一支队伍: mst[i][j] = P(第i支队伍做出至多j道题) 则 P(第i支队伍做出至少j道题) = 1 - mst[i][j-1] 对于所有队伍: P(所有队伍至少答出一题) = ∏ (1 - mst[i][0]) P(…
http://poj.org/problem?id=2151 题意:T个队伍M条题目,给出每个队伍i的每题能ac的概率p[i][j],求所有队伍至少A掉1题且冠军至少A掉N题的概率(T<=1000, M<=30) #include <cstdio> #include <cstring> using namespace std; const int T=1005, M=35; double d[T][M], p[T][M]; int n, m, N; void clr()…
概率DP kuangbin总结中的第8题 一开始题目看错导致想转移方程想错了……想成f[i][j]表示前 i 个队伍中最多的做出来 j 道题的概率……sigh 看了下题解……其实是对于每个队伍 i 单独考虑做出来 j 道题的概率!!最后再根据情况将t个队伍合并起来…… WA:又忘了POJ上double输出应该用%f了……so sad…
Word Puzzles Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 10782 Accepted: 4076 Special Judge Description Word puzzles are usually simple and very entertaining for all ages. They are so entertaining that Pizza-Hut company started using t…
Time Limit: 1000MSMemory Limit: 65536K Total Submissions: 13849Accepted: 4851 Description In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Given your test scores an…
不可以理解的是,测评站上的0ms是怎么搞出来的. 这一题在建立超级源点和超级汇点后就变得温和可爱了.其实它本身就温和可爱.对比了能够找到的题解: (1)艾德蒙·卡普算法(2)迪尼克算法(3)改进版艾德蒙·卡普算法(MY METHOD) 不去管那个0ms的吧,那么(3)号算法最为美妙[它的别名是:ISAP],时间可观. 这个就算是一个ISAP的模板吧(除了输入的难看的几行外,其余均是标准的大米饼牌模板!) #include<stdio.h> #include<algorithm> #…
Time Limit: 3000MSMemory Limit: 65536K Total Submissions: 27109Accepted: 7527 Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water…
Time Limit: 1000MSMemory Limit: 65536K Total Submissions: 19026Accepted: 8466 Description The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributo…
http://poj.org/problem?id=2151 (题目链接) 题意 T支队伍,一共M道题,第i支队伍解出第j道题的概率为p[i][j].问每支队伍至少解出1道题并且解题最多的的队伍至少解出N道题的概率. Solution 我终于明白了,这种题目,永远也不要想着去搞清楚样例是怎么算出来的,只要列出你认为正确的dp方程就行了.. 于是这道题,令${f_{i,j,k}}$表示第i个队伍,前j道题,解出k道的概率.转移很显然: $${f_{i,j,k}=f_{i,j-1,k-1}*p_{i…
1.POJ1258 水水的prim……不过poj上硬是没过,wikioi上的原题却过了 #include<cstring> #include<algorithm> #include<cstdio> using namespace std; ,inf=1e8; ],g[maxn+][maxn+],ans=,n; ]; int main() { scanf("%d",&n); ;i<=n;++i) ;j<=n;++j) { scanf…
流星雨撞击地球(平面直角坐标第一象限),问到达安全地带的最少时间. 对于每颗流星雨i,在ti时刻撞击(xi,yi)点,同时导致(xi,yi)和上下左右相邻的点在ti以后的时刻(包括t)不能再经过(被封锁).安全地带为永远不会被封锁的点. 简单bfs,开始WA在把平面空间上限当成300*300,但根据题目,这只是有流星雨撞击的范围.实际可走的空间理论上没上限,但分析可得,离原点最近的安全地带一定在(302,302)范围内,所以应可把数组至少开为303*303. 后来WA在把G[0][0]==1的情…
题目大意:给n个数,一个长度为k(k<n)的闭区间从0滑动到n,求滑动中区间的最大值序列和最小值序列. 最大值和最小值是类似的,在此以最大值为例分析. 数据结构要求:能保存最多k个元素,快速取得最大值,更新时删去“过期”元素和“不再有希望”的元素,安放新元素. 单调队列的基本概念百度百科讲得比较清楚了:http://baike.baidu.com/view/3771451.htm 我的大致思路是: 1. 每个元素存储为结构体,包含它的秩和值.维护最大长度为k的单调队列,保证所有元素的秩都在区间内…
题意 某场比赛有M道问题,T支队伍,和数字N给出每支队伍解决每道问题的概率. 问这场比赛满足下面两个条件的概率 1.每支队伍至少做出一道题 2.冠军队至少做出N道题. 分析 条件2是不是可以转化为 至少有一支队做出N道及以上道题. 这个题主要是概率,其次才是dp,而且好像不算概率DP. 我们来倒推一下. 设p2为每支队伍做出来的题数都在(1-N-1)的概率.p1为每只队伍至少做出来一道题的概率.那么答案就是p1-p2. 然后我们再来想怎么求p1和p2.设s[i][j]为第i支队伍做出来题数小于等…
Time Limit: 3000MSMemory Limit: 65536K Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication…
poj double 就得交c++,我交G++错了一次 题目:http://poj.org/problem?id=2151 题意:ACM比赛中,共M道题,T个队,pij表示第i队解出第j题的概率 问 每队至少解出一题且冠军队至少解出N道题的概率. 每队均至少做一题的概率P1 减去 每队做题数均在1到N-1之间的概率P2 设dp[i][j][k]表示第i个队在前j道题中解出k道的概率 则: dp[i][j][k]=dp[i][j-1][k-1]*p[j][k]+dp[i][j-1][k]*(1-p…
题意:ACM比赛中,共M道题,T个队,pij表示第i队解出第j题的概率 ,求每队至少解出一题且冠军队至少解出N道题的概率. 析:概率DP,dp[i][j][k] 表示第 i 个队伍,前 j 个题,解出 k 个题的概率,sum[i][j] 表示第 i 个队伍,做出 1-j 个题的概率,ans1等于, T个队伍,至少解出一个题的概率,ans2 表示T个队伍,至少解出一个题,但不超过N-1个题的概率,最后用ans1-ans2即可. 代码如下: #pragma comment(linker, "/STA…
题意:给出m.t.n,接着给出t行m列,表示第i个队伍解决第j题的概率. 现在让你求:每个队伍都至少解出1题,且解出题目最多的队伍至少要解出n道题的概率是多少? 思路:求补集. 即所有队伍都解出题目的概率,减去所有队伍解出的题数在1~n-1之间的概率 这里关键是如何求出某个队伍解出的题数在1~n-1之间的概率,采用dp的方法: 用p(i,j)表示前i道题能解出j道的概率,有p(i,j)=p(i-1,j)*(1-p(i))+p(i-1,j-1)*p(i)p(i)表示解出第i题的概率. #inclu…
有 T(1<T<=1000) 支队伍和 M(0<M<=30) 个题目,已知每支队伍 i 解决每道题目 j 的的概率 p[i][j],现在问:每支队伍至少解决一道题,且解题最多的队伍的题目数量不少于 N(0<N<=M) 的概率是多少? p[i][j]表示第i个队伍做对第j题的概率.dp[i][j][k]表示第i个队伍在前j题中做对了k道的概率.dp[i][j][k] = dp[i][j-1][k-1]*(p[i][j])+dp[i][j-1][k]*(1-p[i][j])…
题目链接:http://poj.org/problem?id=2151 题目大意:有M个题目,T支队伍,第i个队伍做出第j个题目的概率为Pij,问每个队伍都至少做出1个题并且至少有一个队伍做出N题的概率. 先定义状态dp[i][j][k],代表第i支队伍从前j个题目里正好做出k题的概率. 有:dp[i][j][k] = dp[i][j-1][k]*(1-p[i][j]) + dp[i][j-1][k-1]*p[i][j]; 然后设f[i]为前i支队伍里,每队至少做出一个题并且至少有一个队伍做出N…
http://poj.org/problem?id=2151   题意 :t个队伍m道题,i队写对j题的概率为pij.冠军是解题数超过n的解题数最多的队伍之一,求满足有冠军且其他队伍解题数都大于等于1的概率.   f[i][j][w]表示i队到第j题总共解出w道题的概率. 为了避免重复计数; pa=所有队伍到最后一道题时的解题数都大于1的概率; pb=所有队伍到最后一道题时解题数都小于n的概率; 答案为pa-pb.   代码如下 #include<cstdio> #include<cst…
http://poj.org/problem?id=2151 看的题解..表示没看懂状态转移方程.. #include<stdio.h> #include<string.h> int m,t,n; ][][],p[][],tt[][]; int main() { int i,j,k; while(~scanf("%d%d%d",&m,&t,&n)) { if (!m && !t && !n) break;…
解题关键:主要就是概率的推导以及至少的转化,至少的转化是需要有前提条件的. 转移方程:$dp[i][j][k] = dp[i][j - 1][k - 1]*p + dp[i][j - 1][k]*(1 - p)$ 其中$dp[i][j][k]$表示第$i$个人前j题恰好ac了$k$题.然后用前缀和处理一下最后的结果. 每队至少AC一题 反向考虑,用1-每队没A题的概率,再用乘法原理结合一下. 冠军队至少AC$n-1$题,也就是存在一支队伍AC数>=n-1,依然反向考虑,不过是在每队AC至少一题的…
2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MB Description ftiasch是个十分受女生欢迎的同学,所以她总是收到许多情书.虽然她十分有魅力,然而她却是个低调的人.因此她从来不会告诉别人她到底收到了多少情书. ftiasch的好朋友1tthinking想知道她到底收到了多少情书.1tthinking知道,ftiasch每次收到一封情书,就会在日记最后写下一个包含"luvletter"子序列的…