Created
May 29, 2014 23:45
-
-
Save jikeytang/43f023fc397fd52f9f3d to your computer and use it in GitHub Desktop.
[ Javascript ] - 20140530-题目1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
有一种细胞,经过一分钟分裂为2个,再过一分钟,分裂为4个, | |
这样,将一个细胞放在一个瓶子里面,一个小时后瓶子被细胞充满了。 | |
现在假设一开始放入瓶中的为两个细胞,那么到充满瓶子要多长的时间? | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript | |
// you code | |
``` | |
2. 粘贴代码时请使用shift+tab,缩进前面的空白。 |
var cell_division = function(){
var total = Math.pow(2,60), // 60分钟内的分裂的细胞
i = 10;
while(1){
if(Math.pow(4,++i) === total){
return i+1; // 加上第1分钟
}
}
};t
这个懒得写了,
看底数过一分钟 一个2 一个4
时间31
var m=(2<<60)/(1<<60)/2;
console.log(m);
/*范围过高的情况下不能这么干 会出错
1<<60;
268435456
2<<(60-1);
268435456*/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
一个变两个,花掉一分钟,花1小时后爆,请问两个到爆要多久。
去掉前面一分钟不就行了