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 ...
随机推荐
- 【bzoj1042】 HAOI2008—硬币购物
http://www.lydsy.com/JudgeOnline/problem.php?id=1042 (题目链接) 题意 共有4种硬币,面值分别为c1,c2,c3,c4.某人去商店买东西,去了to ...
- 【poj1007】 DNA Sorting
http://poj.org/problem?id=1007 (题目链接) 题意 给出m个字符串,将其按照逆序对个数递增输出. Solution 树状数组经典应用. 代码 // poj1007 #in ...
- Microsoft Hololens 入门系列-01-开篇
1.能做什么 Microsoft HoloLens是第一台运行Windows10系统的全息计算机,它已经不受任何限制——没有线缆和听筒,并且不需要连接电脑.Microsoft Hololens能够让你 ...
- codevs1064 虫食算
题目描述 Description 所谓虫食算,就是原先的算式中有一部分被虫子啃掉了,需要我们根据剩下的数字来判定被啃掉的字母.来看一个简单的例子: 43#9865#045 + 8468#6 ...
- IM通信协议逆向分析、Wireshark自定义数据包格式解析插件编程学习
相关学习资料 http://hi.baidu.com/hucyuansheng/item/bf2bfddefd1ee70ad68ed04d http://en.wikipedia.org/wiki/I ...
- FFTW中文参考
据说FFTW(Fastest Fourier Transform in the West)是世界上最快的FFT.为了详细了解FFTW以及为编程方便,特将用户手册看了一下,并结合手册制作了以下FFTW中 ...
- CentOS 6.4下安装Oracle 11gR2
安装前须知: 内存(RAM)的最小要求是 1GB,建议 2GB 及以上. 虚拟内存 swap 建议:内存为 1GB~2GB 时建议swap大小为内存大小的 1.5 倍:内存为 2GB~16GB 时建议 ...
- 初学hibernate之缓存
一.1.Session级别缓存属于一级缓存,持久化对象保存在Session一级缓存中(一级缓存引用持久化对象地址),只要session不关闭,一级缓存就存在,缓存中对象也不会被回收: Session会 ...
- 用80x86汇编语言编程:1 + 2 + 3 + 4 + 5 + …… + n,和小于100,在屏幕上显示次数和结果。
;============================================== ;1+...+n < 100 ;--------------------------------- ...
- ExecutorService的十个使用技巧
ExecutorService] (https://docs.oracle.com/javase/8/docs/api/java/util/concurrent /ExecutorService.ht ...