FZU 2140 Forever 0.5

思路:队友做的..听说是迷之画一个圆和个三角形...确定四个点其他就随便了


#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define ex 1e-9
using namespace std;
const int maxn = 100 + 10;
struct P{
	double x, y;
	P(){}
	P(double x, double y):x(x), y(y){}
}p[maxn];

void init(){
	double t = 0.003;
	double be = 0.5 + t;
	for(int i=4;i<=100;++i){
		p[i]=P(be, sqrt(1-be*be)+ex);
		be += t;
	}
//	be=sqrt(0.75)+ex+t;
//	for(int i=50;i<=100;++i){
//		p[i]=P(be, sqrt(1-be*be)+ex);
//		be += t;
//	}
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
	p[0]=P(0.0, 0.0);
	p[1]=P(1.0, 0.0);
	p[2]=P(0.5, sqrt(0.75)+ex);
	p[3]=P(sqrt(0.75)+ex, 0.5);
	init();
	int tt,ca=1;
	scanf("%d", &tt);
	while(tt--){
		int n;
		scanf("%d", &n);
		if(n<4){
			printf("No\n"); continue;
		}
		else {
			printf("Yes\n");
			for(int i=0;i<n;++i){
				printf("%.6lf %.6lf\n", p[i].x, p[i].y);
			}
		}
	}

    
    return 0;
}


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

3235

Sample Output

NoNoYes0.000000 0.525731-0.500000 0.162460-0.309017 -0.4253250.309017 -0.4253250.500000 0.162460

Hint

This problem is special judge.



你可能感兴趣的:(FZU 2140 Forever 0.5)