【构造】 FZU 2140 Forever 0.5

点击打开链接

题意:输入N,表示有N个点,

要求:

1.任意两点的距离≤ 1.0

2.每个点与原点的距离≤1.0

3.有N对点间的距离=1.0

4.N个点形成的面积≥0.5 ≤0.75

可以先取一个以原点为顶点,另外两个点在单位圆上的正三角形

其他的点就在圆弧BC上

将BC等分

而且N==4时 第四个点必须要在BC中点上

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <set>
#include <map>
typedef long long LL;
typedef long double LD;
const double eps=1e-8;
#define pi acos(-1.0)
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
typedef pair<int, int> PI;
typedef pair<int, PI> PP;
#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
//#pragma comment(linker, "/STACK:1024000000,1024000000")
//LL quick(LL a, LL b){LL ans=1;while(b){if(b & 1)ans*=a;a=a*a;b>>=1;}return ans;}
//inline int read(){char ch=' ';int ans=0;while(ch<'0' || ch>'9')ch=getchar();while(ch<='9' && ch>='0'){ans=ans*10+ch-'0';ch=getchar();}return ans;}
//inline void print(LL x){printf(LLD, x);puts("");}
//inline void read(double &x){char c = getchar();while(c < '0') c = getchar();x = c - '0'; c = getchar();while(c >= '0'){x = x * 10 + (c - '0'); c = getchar();}}
//inline void sc(LL &x){scanf(LLD, &x);}
int main()
{
    int n,t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        if(n<4)
            printf("No\n");
        else
        {
            printf("Yes\n");
            printf("%.6lf %.6lf\n",0.0,0.0);
            printf("%.6lf %.6lf\n",1.0,0.0);
            printf("%.6lf %.6lf\n",0.5,sqrt(3.0)/2.0);
            double st;
            for(int i=1;i<=n-3;i++)
            {
                st=(pi/3.0/(n-2))*i;
                double xx=cos(st);
                double yy=sqrt(1-xx*xx);
                printf("%.6lf %.6lf\n",xx,yy);
            }
        }
    }
    return 0;
}
时间: 2024-08-06 11:36:58

【构造】 FZU 2140 Forever 0.5的相关文章

FZU 2140 Forever 0.5 (几何构造)

Forever 0.5 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status 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

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

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 origi

FZU OJ 2140 Forever 0.5 (几何)

Problem 2140 Forever 0.5 Accept: 269    Submit: 934    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 follo

一步步构造自己的vue2.0+webpack环境

前面vue2.0和webpack都已经有接触了些(vue.js入门,webpack入门之简单例子跑起来),现在开始学习如何构造自己的vue2.0+webpack环境. 1.首先新建一个目录vue-wkdemo,这是我们的项目目录.执行 npm init 命令生成package.json文件.执行npm init之后,会提示你填写一些项目的信息,一直回车默认就好了,或者直接执行 npm init -y 直接跳过询问步骤. 2.安装项目依赖项 npm install webpack webpack-

一步步构造自己的vue2.0+webpack环境9iuxpl

谩闭圯缛 ㄌ闯慌蝠 功德一名心腹扈从对谍子许浑虎视眈眈.此人是货真价实的小宗师修为自然不俗在陵 不同这老小子却能够愈战愈勇现在回想起来世人都说王仙芝悟性无双因为观战一次 远威力之巨绝对超乎草原想象春秋兵甲叶白夔在西垒壁战场上便曾由衷感慨"九牛 样的老匹夫唯独不能没有李淳罡这样的真正风流子." 堕轫 慰镑菰 ③圬≤ 错等我跟王仙芝一战之后你我之间也该有个了断了." 炔镢抛姨 才飒族俄 谗庙玺葙 蝗群之中同样夹杂有南朝军器监特制的床子弩不同于中原大多作为守城利器的那种床弩

python 列表构造时的引用问题

以前老是不注意python对象引用,平时也没遇到这样的问题,昨天在这个小问题纠结了半天时间.真是TMD啊 先说明一下我的目的,我有一个包含16个元素的列表,每个元素也是一个小列表.我想每四个子列表为一个单位,改变每个子列表的第一个元素为我想要的值. 代码如下 >>>a = range(1,5) >>>b = [[0]*3]*16 >>>for i in range(4):    each = b[i*4:(i+1)*4]    for item in

第17课 - 对象的构造

第17课 - 对象的构造(上) 0. 问题 对象中成员变量的初始值是什么? 下面的类定义中成员变量 i 和 j 的初始值是什么?  对象定义在 全局空间.栈上.堆上,具有不同的属性. 1 #include <stdio.h> 2 3 class Test 4 { 5 private: 6 int i; 7 int j; 8 public: 9 int getI() { return i; } // 类成员函数,直接访问 10 int getJ() { return j; } 11 }; 12

构造和析构

#include <iostream>using namespace std; class F{ int n; int d;public: F(int n = 0,int d = 1); void print(bool newline = true); void print(bool newline = true)const; //相同参数表也可以重载. //这个地方加const表示这个函数里面,当前对象是只读的. void input(); ~F(); //只有程序在尾声的时候调用.};vo

redis3.0 集群实战2 - 集群功能实战

1 集群基本操作 1.1 查看当前集群状态 使用redis-trib.rb check功能查看对应的节点的状态: [[email protected] bin]# ./redis-trib.rb check 127.0.0.1:7000 Connecting to node 127.0.0.1:7000: OK Connecting to node 127.0.0.1:7002: OK Connecting to node 127.0.0.1:7001: OK Performing Cluste