Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- int main() {
- long double x, low, mid, high;
- cin >> x;
- low = 1;
- high = x;
- mid = low + (high - low)/2;
- int p = 2000000;
- while(p--) {
- if(mid * mid > x) {
- high = mid;
- mid = low + (high - low)/2;
- }
- else{
- low = mid;
- mid = low + (high - low)/2;
- }
- if(low>high) {
- break;
- }
- }
- cout << fixed << setprecision(70) << mid;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement