Description
On a small island in the Pacific, islanders want to build a dike around the island, we can simplify the island into a two-dimensional plane, you need to use the K-bar (these edges are either horizontal or vertical lengths of 1 edges, or 45-degree inclined lengths of √2 edges) into a polygon, the vertices of the polygon must be on the whole point, Then to make the polygon area of the largest, you need to ask the maximum area is how much.
Input
The input contains multiple test instances, and each set of instances gives a number k. (3≤k≤2000000000)
Output
Each line corresponds to a required answer. (Keep one decimal place)
Sample Input
3456
Sample Output
0.52.02.54.0
HINT
Source
Chinese do not need to explain test instructions, the key is still drawing ... Find the law, really is very pit, k=7 when the beginning of how to draw is 4.5, then finally found to be 5.5 in short, a problem of egg pain
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <stack > #include <queue> #include <map> #include <set> #include <vector> #include <math.h># Include <bitset> #include <list> #include <algorithm> #include <climits>using namespace std;# Define Lson 2*i#define Rson 2*i+1#define LS l,mid,lson#define RS mid+1,r,rson#define Up (i,x,y) for (i=x;i<=y;i++) # Define down (i,x,y) for (i=x;i>=y;i--) #define MEM (a,x) memset (A,x,sizeof (a)) #define W (a) while (a) #define GCD (A, B) __ GCD (A, b) #define LL long long#define N 200005#define INF 0x3f3f3f3f#define EXP 1e-8#define lowbit (x) (x&-x) const int MO D = 1e9+7;int Main () {LL n,x,y; LL ans; while (~SCANF ("%lld", &n)) {ans = 0; x = N/4; y = n%4; if (y<2) ans = 4*x*x; else ans = 4*x* (x+1); if (y==1) ans+=2*x-1; else if (y==3) ans+=2*x+1; if (ans&1) printf ("%lld.5\n", ANS/2); else printf ("%lld.0\n", ANS/2); } return 0;}
CSU1664: Waterproof Embankment