Problem 2140 Forever 0.5

Accept: 36    Submit: 113    Special Judge
Time Limit: 1000 mSec    Memory Limit : 32768 KB

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

Hint

This problem is special judge.

题意 :给你一个数n,让你找出n个点,满足一下关系:

  • 任意两点的距离不大于1.0
  • 所有点到原点的距离不大于1.0
  • 恰好有N对点的距离为1.0
  • 由这些点构成的n边形的面积不小于0.5
  • 由这些点构成的n边形的面积不大于0.75

如果有就输出yes加上这n个点,如果没有就输出no

思路 : 这个题一开始看样例觉得好复杂,其实画个图推一下倒是可以看出来,要满足上边的条件至少要是4个点,3个点的话是一个等边三角形,面积不符合。因为条件中老是提到1,其实就是一个半径为1的圆以原点为圆心。然后以原点和x轴画一个边长为1的等边三角形,这样的话就有三个点了,其实前四个点都是可以确定的,然后剩下的点从圆上找就可以了,主要是别离那三个点的距离大于1即可,因为圆上的点到圆心的距离都为1,其实就是将圆离散化。

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std ;
double x[],y[] ;
const double temp = 0.005 ;
void chart()
{
x[] = ,y[] = ;
x[] = ,y[] = ;
x[] = 0.5,y[] = sqrt(1.0-0.25) ;
x[] = 0.5 ,y[] = y[]- ;
for(int i = ; i < ; i++)
{
y[i] = i*temp ;
x[i] = sqrt(-y[i]*y[i]) ;
}
}
int main()
{
int T,n ;
chart() ;
scanf("%d",&T) ;
while(T--)
{
scanf("%d",&n) ;
if(n < )
printf("No\n") ;
else
{
printf("Yes\n") ;
for(int i = ; i < n ; i++)
printf("%.6lf %.6lf\n",y[i],x[i]) ;
}
}
return ;
}

FZU 2140 Forever 0.5的更多相关文章

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

    Problem 2140 Forever 0.5 Accept: 371 Submit: 1307 Special Judge Time Limit: 1000 mSec Memory Limit : ...

  2. FZU 2140 Forever 0.5 (几何构造)

    Forever 0.5 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit  ...

  3. FZU 2140 Forever 0.5(将圆离散化)

    主要就是将圆离散化,剩下的都好办 #include<iostream> #include<cstdio> #include<cstring> #include< ...

  4. ACM学习历程—FZU 2140 Forever 0.5(计算几何 && 构造)

    Description   Given an integer N, your task is to judge whether there exist N points in the plane su ...

  5. fzu Problem 2140 Forever 0.5(推理构造)

    题目:http://acm.fzu.edu.cn/problem.php?pid=2140 题意: 题目大意:给出n,要求找出n个点,满足: 1)任意两点间的距离不超过1: 2)每个点与(0,0)点的 ...

  6. Hadoop-2.2.0 + Hbase-0.96.2 + Hive-0.13.1(转)

    From:http://www.itnose.net/detail/6065872.html # 需要软件 Hadoop-2.2.0(目前Apache官网最新的Stable版本) Hbase-0.96 ...

  7. _00018 Hadoop-2.2.0 + Hbase-0.96.2 + Hive-0.13.1 分布式环境整合,Hadoop-2.X使用HA方式

    博文作者:妳那伊抹微笑 itdog8 地址链接 : http://www.itdog8.com(个人链接) 博客地址:http://blog.csdn.net/u012185296 个性签名:世界上最 ...

  8. MTK Recovery 模式横屏修改(适用于6.0 + 8.1)

    修改前 修改后 6.0 Recovery 模式横屏修改方法 修改相关文件 bootable\recovery\minui\Android.mk bootable\recovery\minui\mt_g ...

  9. 系统级性能分析工具perf的介绍与使用

    测试环境:Ubuntu16.04(在VMWare虚拟机使用perf top存在无法显示问题) Kernel:3.13.0-32 系统级性能优化通常包括两个阶段:性能剖析(performance pro ...

随机推荐

  1. monkeyrunner工具同Monkey工具的差别

    Monkey: Monkey工具直接运行在设备或模拟器的adb shell中,生成用户或系统的伪随机事件流. monkeyrunner: monkeyrunner工具则是在工作站上通过API定义的特定 ...

  2. .Net 动态代理,AOP

    .Net 动态代理,AOP 直接上代码了. /***************************************** * author:jinshuai * * E-mail:redfox ...

  3. VMWare中安装CentOS6.6不能上网的解决办法

    1.首先在虚拟机中将网络配置设置成NAT 2.在windows系统,我的电脑-管理-服务 中开启VMware NAT service和VMware DHCP service. 3.在CentOS里面打 ...

  4. 在有大量数据时 少用In(数据会丢失) 用left join 代替

    select @From, @To, EffectiveDate, GETDATE(), Rate from Config_Currency_ExchangeRate_Temp where Effec ...

  5. c#重要特性之一委托

    委托的构成必须满足的4个条件: 声明委托类型: 必须有一个方法包含了要执行的代码: 必须创建一个委托实例: 必须调用(invoke)委托实例 委托包装的方法需要满足以下条件 方法的签名必须与委托一致, ...

  6. Attribute (一)

    本文导读 1.概念 2.自定义一个 Attribute 概念       Attribute是一个特殊的类,我们知道 .NET 程序集 具有自描述的特性(由于元数据),Attribute和.NET的元 ...

  7. 使用SQL Server 2005 新的语法ROW_NUMBER()进行分页的两种不同方式的性能比较

    相比在SQL Server 2000 中使用的分页方式,在SQL Server 2005中使用新的语法ROW_NUMBER()来分页效率要高出很多,但是很多人在使用ROW_NUMBER()这种分页方式 ...

  8. OpenJudge/Poj 1088 滑雪

    1.链接地址: bailian.openjudge.cn/practice/1088 http://poj.org/problem?id=1088 2.题目: 总Time Limit: 1000ms ...

  9. OpenJudge 2817:木棒 / Poj 1011 Sticks

    1.链接地址: http://bailian.openjudge.cn/practice/2817/ http://poj.org/problem?id=1011 2.题目: 总时间限制: 1000m ...

  10. OpenJudge 2813 画家问题 / Poj 1681 Painter's Problem

    1.链接地址: http://bailian.openjudge.cn/practice/2813 http://poj.org/problem?id=1681 2.题目: 总时间限制: 1000ms ...