CSU1664: Waterproof Embankment

Source: Internet
Author: User

Description

On a small island in the Pacific, islanders want to build a dike around the island, and 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 sides, or 45-degree inclined lengths of √2 edges) into a polygon, the vertices of the polygon must be on the whole point, Then make the polygon area the largest, and you need to ask for the maximum area.

Input

The input includes multiple test instances, each given 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 the test instructions, this problem is the key or drawing.

。 Find the rules. Really is very pit, k=7 when the beginning of how to draw is 4.5, and finally found that it is 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.