FZU 2140 Forever 0.5 (几何构造)
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
Sample Output
Hint
This problem is special judge.
题意:找n个点满足上述五个条件。
题解:n=1和n=2的时候不能构成多边形输出No,n=3的时候最大是边长为1的等边三角形,面积为4分之根号3小于0.5不符合条件输出No。当n=4的时候,在等边三角形的一个顶点的高的方向加一个点,距离该顶点的距离为1即可满足五个条件,如图所示。

AC=AB=BC=BD=1。多边形外侧是一个以(0,0)为圆心半径为1的圆。
当n>=5时,在BC弧上加点即可,Smax=S扇形ABC+S三角形ACD=pi/6+1*(1-sqrt(3)/2)/2=0.59058。符合条件。
角bac是60度也就是pi/3,新加入的点的弧度f为pi/3-0.01*(n-4)即可,n最大100,最多加入96个点不会溢出。
新加入点的横坐标就是cos(f),纵坐标就是sin(f)。用y=sqrt(1-x*x)算也行。
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
#define pi 3.1415926535897931
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
if(n<=)
{
printf("No\n");
}
else
{
printf("Yes\n"); //开始的时候忘了输出Yes错了三遍
double a=sqrt()/2.0;
printf("0 0\n");
printf("1 0\n");
printf("0.5 %.6lf\n",a);
printf("0.5 %.6lf\n",a-);
double b=pi/3.0;
for(int i=;i<n-;i++)
{
b=b-0.01;
printf("%.6lf %.6lf\n",cos(b),sin(b));
}
}
}
return ;
}
FZU 2140 Forever 0.5 (几何构造)的更多相关文章
- FZU 2140 Forever 0.5(找规律,几何)
Problem 2140 Forever 0.5 Accept: 371 Submit: 1307 Special Judge Time Limit: 1000 mSec Memory Limit : ...
- FZU 2140 Forever 0.5
Problem 2140 Forever 0.5 Accept: 36 Submit: 113 Special JudgeTime Limit: 1000 mSec Memory ...
- fzu Problem 2140 Forever 0.5(推理构造)
题目:http://acm.fzu.edu.cn/problem.php?pid=2140 题意: 题目大意:给出n,要求找出n个点,满足: 1)任意两点间的距离不超过1: 2)每个点与(0,0)点的 ...
- 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 ...
- FZU 2140 Forever 0.5(将圆离散化)
主要就是将圆离散化,剩下的都好办 #include<iostream> #include<cstdio> #include<cstring> #include< ...
- spring 3.0 应用springmvc 构造RESTful URL 详细讲解
在线springmvc_rest demo 由于下一版本的rapid-framwork需要集成spring RESTful URL,所以研究了一下怎么搭建. 并碰到了一下问题. springmvc 3 ...
- fzu 2035 Axial symmetry(枚举+几何)
题目链接:fzu 2035 Axial symmetry 题目大意:给出n个点,表示n边形的n个顶点,判断该n边形是否为轴对称图形.(给出点按照图形的顺时针或逆时针给出. 解题思路:将相邻两个点的中点 ...
- swift3.0 基础练习-构造对象并按要求进行排序(struct)
struct练手 构造10个学生(要求有学生的姓名.数学成绩.英语成绩),按照学生英语和数学平均分的成绩从小到大输出学生的姓名.数学成绩.英语成绩及平均分 创建一个学生构造体,包含 姓名 name 数 ...
- SDL2.0的几何图行绘画
SDL2.0的几何图形绘画 通过SDL_Window.SDL_Renderer.SDL_Texture三者实现了简单的几何图形绘画. 包括了SDL_RenderDrawPoint.SDL_Render ...
随机推荐
- BZOJ-1050 旅行comf 并查集+乱搞
好久以前codevs上做过的,拿着改了改.. 1050: [HAOI2006]旅行comf Time Limit: 10 Sec Memory Limit: 162 MB Submit: 2194 S ...
- 【长期更新】--神犇的BLOGS(各种高端讲解)
KMP字符串匹配算法: http://kb.cnblogs.com/page/176818/ http://blog.csdn.net/yutianzuijin/article/details/119 ...
- POJ2437 Muddy roads
Description Farmer John has a problem: the dirt road from his farm to town has suffered in the recen ...
- eclipse下载
http://www.eclipse.org/downloads/eclipse-packages
- 神器Alfred使用
神器官网:http://www.alfredapp.com/ 许多人装好了之后就再也没有怎么使用过,这软神器, 一直不明白它为什么叫神器,最近研究了一下,真的是,很多东西我们没有好好利用 部分使用功能 ...
- c语言 函数传输传递的三种方式(值、指针、引用)
本文摘自<彻底搞定c指针> 一.三道考题开讲之前,我先请你做三道题目.(嘿嘿,得先把你的头脑搞昏才行……唉呀,谁扔我鸡蛋?)考题一,程序代码如下:void Exchg1(int x, in ...
- javascript仿天猫加入购物车动画效果
javascript仿天猫加入购物车动画效果 注意:首先需要声明的是:代码原思路不是我写的,是在网上找的这种效果,自己使用代码封装了下而已:代码中都有注释,我们最主要的是理解抛物线的思路及在工作中 ...
- sql数据库常用语句总结
1.增加字段 alter table docdsp add dspcodechar(200)2.删除字段 ALTER TABLE table_NAME DROP COLUMNc ...
- 数据库的设计(E-R图,数据库模型图,三大范式)
一.数据库设计的概念 数据库设计是将数据库中的数据实体及这些数据实体之间的关系,进行规划和结构化的过程. 二.数据库设计的重要性 如果一个数据库没有进行一个良好的设计,那么这个数据库完成之后他的缺点是 ...
- Python ===if while for语句 以及一个小小网络爬虫实例
if分支语句 >>> count=89 >>> if count==89: print count 89 #单分支 ...