FZU 2140 Forever 0.5

原创 2018年04月17日 10:46:51

Problem Description

Given an integer N, your task is to judge whether there exist N points in the plane such that satisfy the following conditions:

  1. The distance between any two points is no greater than 1.0.

  2. The distance between any point and the origin (0,0) is no greater than 1.0.

  3. There are exactly N pairs of the points that their distance is exactly 1.0.

  4. The area of the convex hull constituted by these N points is no less than 0.5.

  5. The area of the convex hull constituted by these N points is no greater than 0.75.

Input

The first line of the date is an integer T, which is the number of the text cases.

Then T cases follow, each contains an integer N described above.

1 <= T <= 100, 1 <= N <= 100

Output

For each case, output “Yes” if this kind of set of points exists, then output N lines described these N points with its coordinate. Make true that each coordinate of your output should be a real number with AT MOST 6 digits after decimal point.

Your answer will be accepted if your absolute error for each number is no more than 10-4.

Otherwise just output “No”.

See the sample input and output for more details.

Sample Input

3
2
3
5

Sample Output

No
No
Yes
0.000000 0.525731
-0.500000 0.162460
-0.309017 -0.425325
0.309017 -0.425325
0.500000 0.162460

解题思路

以原点为圆心,半径为1的圆内,以原点为顶点,变成为1的正三角形另外两个点在圆上,你会发现,两个点之间的那段弧,上的所有点都是满足条件的,所以只要三个顶点分别是正三角形的三个顶点,其余的点在弧上,都是正确的
这里写图片描述

题解代码

#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;
int n;
int t;
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        if(n<=3)
            printf("No\n");
        else
        {
            printf("Yes\n");

            printf("0.000000 0.000000\n");
            printf("0.500000 %.6f\n",-1.0*sqrt(3.0)/2);
            printf("-0.500000 %.6f\n",-1.0*sqrt(3.0)/2);
            for(int i=1;i<=n-3;i++)
                printf("-0.000000 -1.000000\n");
        }

    }
            return 0;

}
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/AcmAres/article/details/79971484

FZU 2140 Forever 0.5 (几何_思维)

题意 :给你一个数n,让你找出n个点,满足一下关系: 任意两点的距离不大于1.0所有点到原点的距离不大于1.0恰好有N对点的距离为1.0由这些点构成的n边形的面积不小于0.5由这些点构成的n边形...
  • h1021456873
  • h1021456873
  • 2016-04-16 11:50:51
  • 378

FZU 2140 Forever 0.5(找规律,几何)

FZU 2140 Forever 0.5
  • Dacc123
  • Dacc123
  • 2016-04-16 10:33:31
  • 457

fzu-2140 Forever 0.5

题目: Given an integer N, your task is to judge whether there exist N points in the plane such that ...
  • qq_32360995
  • qq_32360995
  • 2017-08-12 13:26:17
  • 68

FZU 2140 Forever 0.5

Given an integer N, your task is to judge whether there exist N points in the plane such that ...
  • weixin_40367307
  • weixin_40367307
  • 2018-04-14 19:57:41
  • 6

Forever 0.5 FZU - 2140

Given an integer N, your task is to judge whether there exist N points in the plane such that satis...
  • qq_36424540
  • qq_36424540
  • 2018-04-14 15:33:57
  • 6

FZU 2140 Forever 0.5

Description Given an integer N, your task is to judge whether there exist N points in the plane s...
  • jtjy568805874
  • jtjy568805874
  • 2016-04-14 21:07:47
  • 336

FZU 2140 Forever 0.5

A - Forever 0.5 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit ...
  • abgnwl
  • abgnwl
  • 2015-05-02 09:25:11
  • 466

FZU Problem 2140 Forever 0.5

竟然是一个找规律,推出图形后直接在上面加一些点。真是长知识了啊。 注意:是有n条边满足长度为1。 一定要先做出来那个一个点在圆心其他三个点在正规圆的四边形出来,然后其他的点在两个点之间插就行了啊。 ...
  • xu12110501127
  • xu12110501127
  • 2014-03-16 21:25:59
  • 964

FZU 2140 Forever 0.5(计算几何)

A - Forever 0.5 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Sub...
  • qq_18661257
  • qq_18661257
  • 2016-08-12 19:15:44
  • 463

fzu 2140 Forever 0.5(推理)

题目链接:fzu 2140 Forever 0.5 题目大意:给出n,要求找出n个点,满足: 1)任意两点间的距离不超过1; 2)每个点与(0,0)点的距离不超过1; 3)有n对点之间...
  • u011328934
  • u011328934
  • 2013-12-22 18:55:06
  • 1337
收藏助手
不良信息举报
您举报文章:FZU 2140 Forever 0.5
举报原因:
原因补充:

(最多只允许输入30个字)