摘要:
Implementint sqrt(int x).Compute and return the square root ofx.思路: 突然发现,二分真TM的是万能的。还有牛顿迭代法,数学的东西,头疼不想看了。还有传说中的“魔数”法,比math库效率都高,试了下RE - -。C++: 1 clas... 阅读全文
posted @ 2015-08-01 15:33
tjuloading
阅读(216)
评论(0)
推荐(0)
摘要:
Implement pow(x,n).思路: 实现pow(x,n)函数。首先,可以n次连乘x,但是这样太慢了。加速:2^10 -> 4^5 -> 16^2 * 4 ->256^1 * 4C++: 1 class Solution { 2 public: 3 double myPow(dou... 阅读全文
posted @ 2015-08-01 14:04
tjuloading
阅读(226)
评论(0)
推荐(0)

浙公网安备 33010602011771号