1 solutions
-
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
Information
- ID
- 16934
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- (None)
- # Submissions
- 0
- Accepted
- 0
- Uploaded By