FZU 2140 Forever 0.5(找规律,几何)
Problem 2140 Forever 0.5
Accept: 371 Submit: 1307 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:
The distance between any two points is no greater than 1.0.
The distance between any point and the origin (0,0) is no greater than 1.0.
There are exactly N pairs of the points that their distance is exactly 1.0.
The area of the convex hull constituted by these N points is no less than 0.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;
}
FZU 2140 Forever 0.5(找规律,几何)的更多相关文章
- FZU 2140 Forever 0.5
Problem 2140 Forever 0.5 Accept: 36 Submit: 113 Special JudgeTime Limit: 1000 mSec Memory ...
- FZU 2140 Forever 0.5 (几何构造)
Forever 0.5 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit ...
- 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< ...
- fzu Problem 2140 Forever 0.5(推理构造)
题目:http://acm.fzu.edu.cn/problem.php?pid=2140 题意: 题目大意:给出n,要求找出n个点,满足: 1)任意两点间的距离不超过1: 2)每个点与(0,0)点的 ...
- 翻翻棋(找规律问题)(FZU Problem 2230)
题目是这样的: FZU Problem 2230 象棋翻翻棋(暗棋)中双方在4*8的格子中交战,有时候最后会只剩下帅和将.根据暗棋的规则,棋子只能上下左右移动,且相同的级别下,主动移动到地方棋子方将吃 ...
- FZU2168——防守阵地 I——————【找规律或前缀和】
防守阵地 I Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 3951 - Coin Game(找规律)
这道题是有规律的博弈题目,,, 所以我们只需要找出规律来就ok了 牛人用sg函数暴力找规律,菜鸟手工模拟以求规律...[牢骚] if(m>=2) { if(n<=m) {first第一口就 ...
- HDU 5703 Desert 水题 找规律
已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...
随机推荐
- HBase源代码分析之HRegionServer上MemStore的flush处理流程(二)
继上篇文章<HBase源代码分析之HRegionServer上MemStore的flush处理流程(一)>遗留的问题之后,本文我们接着研究HRegionServer上MemStore的fl ...
- 使用 ChromaKey 滤镜进行抠图
简介 Nokia Imaging SDK 1.0 中新提供的 ChromaKey 滤镜是一个神奇的滤镜,它的基本原理就是把 一个指定范围值内的颜色变为透明或半透明,比如下面的 demo 演示的,看上 ...
- vue项目中,main.js,App.vue,index.html如何调用
1.main.js是我们的入口文件,主要作用是初始化vue实例,并引入所需要的插件 2.App.vue是我们的主组件,所有页面都是在App.vue下进行切换的.其实你也可以理解为所有的路由也是App. ...
- 0061 Spring MVC的数据格式化--Formatter--FormatterRegistrar--@DateTimeFormat--@NumberFormat
Converter只完成了数据类型的转换,却不负责输入输出数据的格式化工作,日期时间.货币等虽都以字符串形式存在,却有不同的格式. Spring格式化框架要解决的问题是:从格式化的数据中获取真正的数据 ...
- Unity3D学习(九):C#和C++的相互调用
前言 不知不觉已经一年了,这一年来一直忙于公司项目疯狂加班,很少有自己的时间写下东西.不过好在项目最近也步入正轨了,正好抽空写点东西记录下学到的一些东西. 公司项目是一个端游IP移植手游,端游是基于C ...
- PDF文件的加载及展示
项目需要显示PDF文件,于是遍寻了网络,发现的方法以下几种: 1.使用UIWebView加载,没啥说的,根据文件路径,网络或者本地皆可,创建一个NSURLRequest,然后用webView加载就可以 ...
- phpstrom直接运行和调试php
最近想学服务器开发,但是没找到免费的虚拟主机,好在有一大把的php主机, 于是决定学php了,但并不准备学网页制作,只是把php作为服务器逻辑处理语言. 下载xampp,打开phpstrom的设置界面 ...
- jquery获取的html元素和document获取的元素的区别
最近通过ocx做了一个视频插件,然后将插件放到html中(想知道的可以看一下) 因为我要操作这个插件,要播放,停止等,所以我需要获取这个元素,不出意外的,我就用jquery来获取,然后根本无法执行,然 ...
- 获取checkbox 组成字符串
<input type="checkbox" id="goods_server_name" name="goods_server_name[]& ...
- TensorFlow基础笔记(8) TensorFlow简单人脸识别
数据材料 这是一个小型的人脸数据库,一共有40个人,每个人有10张照片作为样本数据.这些图片都是黑白照片,意味着这些图片都只有灰度0-255,没有rgb三通道.于是我们需要对这张大图片切分成一个个的小 ...