input T 1<=T<=10000 n m 1<=n<=2000000007 1<=m<=32 output m个鸡蛋从1到n哪一楼x扔下去刚好没碎,而再x+1楼扔下去就碎了,求最少扔的次数无论x为1到n的哪个数都能确定x 如果x>32,输出Impossible,否则输出x 做法:dp,d(x,y)=d(x,y-1)+d(x-1,y-1),x:egg,y:floor求出下限,即x个鸡蛋至少要试多少次 # include <stdio.h> # in…
这是一道经典的DP模板题. https://vjudge.net/problem/POJ-3783#author=Herlo 一开始也是不知道咋写,尝试找了很多博客,感觉有点领悟之后写下自己的理解. 题意就是: 对于一种蛋,如果它在第m层楼摔不碎,但是在第m+1层摔碎了,那么它的硬度就是m. 有若干层楼,你有若干个一样的蛋,你每一次尝试的结果都会是最坏的情况,问你在这种运气最差的情况下至少丢几次蛋才能知道它的硬度. A. 如果蛋的数量是0,那根本都尝试不了,只能试0次 B. 如果你只有一个蛋,那…
6.5 There is a building of 100 floors. If an egg drops from the Nth floor or above, it will break. If it's dropped from any floor below, it will not break. You're given two eggs. Find N, while minimizing the number of drops for the worst case 这道题说有10…
2014-05-03 22:10 题目链接 原题: Given a dictionary, and a list of letters ( or consider as a string), find the longest word that only uses letters from the string. [I didn't meet this question, what's the best solution?] 题目:给定一个字符串,和一个字典.从字典中找出一个最长的词,并且这个词…