Balls(poj 3783)】的更多相关文章

The classic Two Glass Balls brain-teaser is often posed as: “Given two identical glass spheres, you would like to determine the lowest floor in a 100-story building from which they will break when dropped. Assume the spheres are undamaged when droppe…
作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4098409.html 题目链接:poj 3783 Balls 动态规划 100层楼投鸡蛋问题 使用动态规划算法,使用$dp[i][j]$表示对于i层楼并拥有$j$个鸡蛋时能够判断鸡蛋质量需要的最少次数.假如我们在第$k$层扔下一个鸡蛋,则有两种情况,如果鸡蛋没有损坏则问题相当于我们对于$i-k$层楼拥有$j$个鸡蛋所需的最少的次数.如果鸡蛋损坏了,则问题相当于对于k层楼拥有$j-1$个鸡蛋…
题目链接 这个问题是谷歌面试题的加强版,面试题问的是100层楼2个鸡蛋最坏扔多少次:传送门. 下面我们来研究下这个题,B个鸡蛋M层楼扔多少次. 题意:给定B (B <= 50) 个一样的球,从 M (M <= 1000) 层楼上一个一个往下扔,存在某个楼层K,使得低于它的楼层往下扔球,球不会碎,在第K层扔下去会碎.求最坏情况下,需要扔几次才能确定这个K. dp[i][j] 表示有i层楼, 剩余j个球时, 最坏情况要确定K 所需的次数 那么在这些楼层里 我们可以选择在k层(1<= k &l…
Balls Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1196   Accepted: 783 Description The classic Two Glass Balls brain-teaser is often posed as: "Given two identical glass spheres, you would like to determine the lowest floor in a 100-…
优先队列 + 反向拓扑 //#include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<algorithm> #include<queue> #include<cstring> using namespace std; ; int n, m; vector<int>G[maxn]; int inDeg[maxn]; int dp[maxn]; i…
Labeling Balls Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10161   Accepted: 2810 Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 toN in such a way that: No two balls share…
Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No two balls share the same label. The labeling satisfies several constrains like "The ball labeled with a is lighter than the on…
Labeling Balls Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16100   Accepted: 4726 Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No two balls share…
http://poj.org/problem?id=3687 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14842   Accepted: 4349 Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No…
Labeling Balls Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9641 Accepted: 2636 Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No two balls share the…