[leetcode]Pow(x, n)
来源:互联网 发布:成都大学网络教学平台 编辑:程序博客网 时间:2024/04/29 07:56
class Solution {public: double powPositive(double x, int n){ if(n == 0) return 1; if(n == 1) return x; double tmp; if(n%2 == 0){ tmp = powPositive(x, n/2); return tmp*tmp; } tmp = powPositive(x, n/2); return tmp*tmp*x; } double pow(double x, int n) { // Start typing your C/C++ solution below // DO NOT write int main() function if(n >= 0) return powPositive(x,n); return 1/powPositive(x,-n); }};
- LeetCode: Pow(x, n)
- LeetCode Pow(x,n)
- [Leetcode] Pow(x, n)
- LeetCode: Pow(x, n)
- Leetcode: Pow(x,n)
- [LeetCode] Pow(x, n)
- [Leetcode] Pow(x,n)
- 【leetcode】Pow(x, n)
- [LeetCode]Pow(x, n)
- [leetcode]Pow(x, n)
- LeetCode-Pow(x, n)
- LeetCode - Pow(x, n)
- LeetCode | Pow(x, n)
- Pow(x, n) -leetcode
- 【leetcode】Pow(x, n)
- 【Leetcode】Pow(x, n)
- LeetCode Pow(x, n)
- Leetcode: Pow(x, n)
- cocos2d-x 2.1.4 android 开发环境搭建
- Linux指令初学——鸟哥的Linux私房菜(二)
- hdu 2222 Keywords Search(AC自动机模板题)
- 【技术类】【看我影像平台新特性】ArcGIS 10.2影像平台新特性概览
- 多线程编程总结
- [leetcode]Pow(x, n)
- ACM培养计划2
- linux svn命令大全
- hdu 4635 Strongly connected(Tarjan)
- VC++里面画图的知识
- uva 10106
- winSock 实现文件的传输
- ubuntu lvs
- 创建线程后为什么马上调用CloseHandle()来关闭句柄