LeeCode-Sqrt(x)Implement int sqrt(int x). Compute and return the square root of x.
2016-04-26 20:46
507 查看
Implement
Compute and return the square root of x.
int mySqrt(int x)
{
if(x==1)
return 1;
/* for(int i=2;i<=x/2;i++)
{
if(x=i*i)
{
return i;
}
}*/
return (int)sqrt(x);
}
int sqrt(int x).
Compute and return the square root of x.
int mySqrt(int x)
{
if(x==1)
return 1;
/* for(int i=2;i<=x/2;i++)
{
if(x=i*i)
{
return i;
}
}*/
return (int)sqrt(x);
}
相关文章推荐
- Android5.0之NavigationView的使用
- Android5.0之NavigationView的使用
- Struts2 - 常用的constant总结
- c++作业4
- 剑指offer(32):连续子数组的最大和
- 第 6 章 表格元素
- CSAPP(2):程序的汇编表示(Linux版)
- Android5.0之NavigationView的使用
- Linggle: 英语写作学习搜索引擎
- Java基础笔记:Java的基本语法
- Swift 很强大的图表库-Charts使用
- 欢迎使用CSDN-markdown编辑器
- @RequestBody和@ResponseBody的简单使用
- Oracle_expdp_impdp用法详解
- icinga 服务端-客户端安装配置
- 如果json字符串中的key值中没有数据解析用opt,也会出现空指针异常。
- 25.Spark Sort-Based Shuffle内幕彻底解密
- 提升 LaTeX 效率的小工具:Detexify LaTeX handwritten symbol recognition
- LeeCode-Remove Linked List Elements
- 山东省第五届ACM省赛题——Circle(递推求概率)