化简问题
来源:互联网 发布:csol显卡优化 编辑:程序博客网 时间:2024/05/22 13:53
public class Solution {
public double myPow(double x, int n) {
if(n==0) return 1;
else if(n<0) return 1/unsignedPow(x, -n);
else return unsignedPow(x, n);
}
public double unsignedPow(double x, int n){
if(n==1) return x;
if(n%2==1) return x*myPow(x,n-1);
else
{
double tmp = myPow(x, n/2);
return tmp*tmp;
}
}
}
public double myPow(double x, int n) {
if(n==0) return 1;
else if(n<0) return 1/unsignedPow(x, -n);
else return unsignedPow(x, n);
}
public double unsignedPow(double x, int n){
if(n==1) return x;
if(n%2==1) return x*myPow(x,n-1);
else
{
double tmp = myPow(x, n/2);
return tmp*tmp;
}
}
}
0 0
- 化简问题
- redis-bgrewriteaof问题--持久化恢复问题
- ANR问题简析
- 序列化问题
- 序列化NotSerializableException问题
- java 序列化 问题
- 序列化问题!Datatable
- java序列化问题
- 序列化问题
- HashSet序列化问题
- Java串行化问题
- 序列化--画图问题
- nutch持久化问题
- Hibernate持久化问题
- Android 碎片化问题
- Java序列化问题
- 序列化相关问题
- NGUI-实例化问题
- sbt使用自定义仓库
- hdu 5564 Clarke and digits (dp+矩阵加速)
- wtl学习开篇
- 批量删除VC&VS中的临时文件方法
- http压力测试
- 化简问题
- Sublime Text 3 快捷键汇总
- myeclipse删除工程后出现Could not publish to the server
- 虚函数、纯虚函数通俗解释(C++,Java)
- 15-11-16 Eclipse 操作菜单汉译之Edit [编辑]
- Codeforces Gym 100796E Permutation Polygon(线段树)
- Cocos Play提升3倍转化率:手游微端革命
- LeetCode:Bulls and Cows
- dom4j 解析xml字符串 去除.DTD校验