Created
May 12, 2015 10:28
-
-
Save lp6m/9b426f93403b6d40e153 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <stack> | |
#include <queue> | |
#include <map> | |
#include <cmath> | |
#include <string> | |
#include <sstream> | |
#include <iomanip> | |
#include <complex> | |
using namespace std; | |
#define ll long long | |
#define vvi vector< vector<int> > | |
#define vi vector<int> | |
#define All(X) X.begin(),X.end() | |
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define pb push_back | |
#define pii pair<int,int> | |
#define mp make_pair | |
#define pi 3.14159265359 | |
#define shosu(X) fixed << setprecision(X) | |
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} | |
ll lcm(ll a,ll b){return a/gcd(a,b)*b;} | |
int main(){ | |
double d; | |
cin >> d; | |
double ans = sqrt(2)*d; | |
for(int b=1;b<10;b++){ | |
if((d*d-b*b)<0) continue; | |
double a = sqrt(d*d-b*b); | |
if(a<1) ans = max(ans,(double)b+1); | |
} | |
cout << shosu(10) << ans << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment