1 条题解
-
0
C++ :
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int main() { double a,x0,x1; cin>>a; x0=a/2; x1=(x0+a/x0)/2; while (fabs(x1-x0)>1e-5) { x0=x1; x1=(x0+a/x0)/2; } printf("%.3lf\n",x1); return 0; }
Pascal :
var s:longint; begin readln(s); writeln(sqrt(s):0:3); end.
- 1
信息
- ID
- 1554
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- (无)
- 递交数
- 0
- 已通过
- 0
- 上传者