fzu Problem 2140 Forever 0.5(推理构造)
2024-08-22 10:37:54
题目:http://acm.fzu.edu.cn/problem.php?pid=2140
题意:
题目大意:给出n,要求找出n个点,满足:
1)任意两点间的距离不超过1;
2)每个点与(0,0)点的距离不超过1;
3)有n对点之间的距离刚好为1;
4)n个点组成的多边形面积大于0.5;
5)n个点组成的多边形面积小于0.75;
思路:只要有4个点以上就是,构造时先找出四个点,再在半径为1的圆上找点就行。
很巧妙的一道题目呀、、、、
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std; double x[], y[];
void slo()
{
x[] = ; y[] = ;
x[] = ; y[] = ;
x[] = 0.5; y[] = sqrt(-0.5*0.5);
x[] = 0.5; y[] = y[]-;
for(int i = ; i < ; i++)
{
x[i] = -0.001*i;
y[i] = sqrt(-x[i]*x[i]);
}
}
int main()
{
int t, n;
cin>>t;
slo();
while(t--)
{
cin>>n;
if(n<=)
cout<<"No"<<endl;
else
{
cout<<"Yes"<<endl;
for(int i = ; i < n; i++)
printf("%.6lf %.6lf\n", x[i], y[i]);
}
}
return ;
}
最新文章
- java读取项目根路径下和任意磁盘位置下的properties文件
- cocos IDE 编译lua 游戏程序的环境配置
- entity framework 新手入门篇(1.5)-lambda表达式与linq
- 手把手教你如何加入到github的开源世界!
- python模块介绍- collections(5)-OrderedDict 有序字典
- ArrayList和Vector以及synchronizedList
- Win7下的本地网站发布
- hdu 2883 kebab 网络流
- glog使用
- Android笔记5-与USB HID 设备通信(一)
- VC实现卡拉OK字幕叠加
- --@angularJS--指令之单个点击展开demo
- tomcat设置错误页面
- 将replicated数据与元数据关联
- 从零开始学 Web 之 Vue.js(三)Vue实例的生命周期
- hdu3861 强连通分量缩点+二分图最最小路径覆盖
- python抽象方法
- 字典学习(Dictionary Learning, KSVD)详解
- 20170728xlVba还是这个混蛋
- 【转】每天一个linux命令(52):ifconfig命令