r******m 发帖数: 6 | 1 两个鸡蛋俺是弄明白了
三个折腾了一会,把自己绕晕了,
这要N个,咋整啊? | h*****0 发帖数: 4889 | 2 明白三个的,不就已经明白N个的了吗?
【在 r******m 的大作中提到】 : 两个鸡蛋俺是弄明白了 : 三个折腾了一会,把自己绕晕了, : 这要N个,咋整啊?
| p*****k 发帖数: 318 | 3 it's essentially recursion.
if you post your thoughts on 3 eggs, we might be able to help you:)
【在 r******m 的大作中提到】 : 两个鸡蛋俺是弄明白了 : 三个折腾了一会,把自己绕晕了, : 这要N个,咋整啊?
| h*****0 发帖数: 4889 | 4 that's right.
【在 p*****k 的大作中提到】 : it's essentially recursion. : if you post your thoughts on 3 eggs, we might be able to help you:)
| h*****0 发帖数: 4889 | 5 a simple hint:
1+1+1+1+...
1+2+3+4+...
1+3+6+10+...
【在 r******m 的大作中提到】 : 两个鸡蛋俺是弄明白了 : 三个折腾了一会,把自己绕晕了, : 这要N个,咋整啊?
| o****e 发帖数: 80 | 6 i think for the case of 3 eggs, should be like this
start from n-th floor, then try middle floor of n/2-th , then use the 3rd
egg to try either upper half section
or lower half section,
so for the n-th floor, the max try will be (n+2)/2;
then go to the n-2 th floor, the max try will be n/2
and so on
so the sequence will be like this
n, n-2, n-4, n-6, ......... until 4 th floor,
in total n+(n-2)+(n-4)+...+4=n(n+2)/4-2
if we want to test 100 floors, then n(n+2)/4-2>=100 -----> n=20
so for 100
【在 h*****0 的大作中提到】 : a simple hint: : 1+1+1+1+... : 1+2+3+4+... : 1+3+6+10+...
| o*t 发帖数: 655 | | f*******y 发帖数: 267 | 8 hero is right.
m=1: 1+1+1+..
m=2: 1+2+3+..
m=3: 1+3+6+10+...= sum_n n*(n+1)/2
if n=100, the optimal is starting at 8*9/2=36
if x<36, use m=2 method, requires 8 throws; if x>36, throw the third egg at
36+ 7*8/2 = 64 until it breaks.
balancing. not sure if it's correct...
【在 r******m 的大作中提到】 : 两个鸡蛋俺是弄明白了 : 三个折腾了一会,把自己绕晕了, : 这要N个,咋整啊?
|
|