咖啡


私信TA

用户名:Tianxn

访问量:128009

签 名:

十年OI一场空,不开LL见祖宗。

等  级
排  名 8
经  验 26033
参赛次数 10
文章发表 197
年  龄 22
在职情况 学生
学  校 西安电子科技大学
专  业 软件工程

  自我简介:


解题思路:

注意事项:

参考代码:

#include <stdio.h>
#include <math.h> 
int main(void)
{
	int X;
	double sqrt_x = 1, t;
	scanf("%d", &X);
	do
	{
		t = sqrt_x;
		sqrt_x = (t + 1.0*X/t)/2;
	}while(fabs(sqrt_x-t) > 10e-5);
	printf("%.3lf\n", sqrt_x);
    return 0;
}


 

0.0分

0 人评分

  评论区