find square root
public class Solution {
public static void main(String[] args) {
Scanner ip = new Scanner(System.in);
System.out.print("Enter a number: ");
double n = ip.nextDouble();
System.out.println(sqrt(n));
ip.close();
}
public static double sqrt(double number) {
double t;
double squareRoot = number / ;
do {
t = squareRoot;
squareRoot = (t + (number / t)) / ;
} while ((t - squareRoot) != );
return squareRoot;
}
}
find square root的更多相关文章
- Codeforces 715A. Plus and Square Root[数学构造]
A. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Project Euler 80:Square root digital expansion 平方根数字展开
Square root digital expansion It is well known that if the square root of a natural number is not an ...
- Codeforces 612E - Square Root of Permutation
E. Square Root of Permutation A permutation of length n is an array containing each integer from 1 t ...
- Codeforces 715A & 716C Plus and Square Root【数学规律】 (Codeforces Round #372 (Div. 2))
C. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- (Problem 57)Square root convergents
It is possible to show that the square root of two can be expressed as an infinite continued fractio ...
- Square Root
Square RootWhen the square root functional configuration is selected, a simplified CORDIC algorithm ...
- Codeforces Round #372 (Div. 1) A. Plus and Square Root 数学题
A. Plus and Square Root 题目连接: http://codeforces.com/contest/715/problem/A Description ZS the Coder i ...
- Plus and Square Root
ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ...
- CodeChef - SQRGOOD:Simplify the Square Root (求第N个含平方因子数)
Tiny Wong the chef used to be a mathematics teacher in a senior high school. At that time, he always ...
- Project Euler 57: Square root convergents
五十七.平方根收敛(Square root convergents) 二的平方根可以表示为以下这个无穷连分数: \[ \sqrt 2 =1+ \frac 1 {2+ \frac 1 {2 +\frac ...
随机推荐
- lambda的用法
关于lambda的用法: lambda的用法和def的用法基本相同.区别在于def可以用来定义简单和复杂的函数,而lambda主要用来定义简单的函数.下面通过两个例子来了解下: lambda 参数1, ...
- Vue 结合 SignalR 实现前后端实时消息同步
最近业务中需要实现服务器端与客户端的实时通信功能,对Signalr做了一点总结和整理. SignalR 作为 ASP.NET 的一个库,能够简单方便地为应用提供实时的服务器端与客户端双向通信功能. ...
- nginx 日志配置log_format用法
nginx服务器日志相关指令主要有两条: 1.一条是log_format,用来设置日志格式: 2.另外一条是access_log,用来指定日志文件的存放路径.格式和缓存大小,可以参加ngx_http_ ...
- AOP方法拦截获取参数上的注解
https://www.jianshu.com/p/f5c7417a75f9 获取参数注解 在spring aop中,无论是前置通知的参数JoinPoint,还是环绕通知的参数ProceedingJo ...
- python 提取整个 HTML 节点
有的时候,需要把整个 HTML 节点原封不动地取下来,也就是包括节点标签.节点内容,甚至也包括内容中的空格.各种特殊符号等等. 假设已获取到页面源码,并将其保存在变量 src 中.则可有代码如下: f ...
- OC-加载h5富文本的代码,并计算高度
参考文章: 加载富文本的h5代码:https://zhidao.baidu.com/question/1510839173546014340.html 计算富文本的高度:https://zhidao. ...
- 剑指offer 8:旋转数组的最小数字
题目描述 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转.输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素.例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转 ...
- 个人项目:WC
一.GitHub项目地址:https://github.com/lseap/myWC 二.PSP表格: PSP2.1 Personal Software Process Stages 预估耗时(分钟) ...
- 多版本切换python
Python 安装包去官网自行下载: https://www.python.org/downloads/mac-osx/ Mac os 自带python, 但我记得是python2.7版本 在选择安装 ...
- [b0016] python 归纳 (二)_静态方法和类方法
# -*- coding: UTF-8 -*- """ 测试 类的静态方法,类方法 @staticmethod @classmethod 总结: 1. self 指向类对 ...