fzu Problem 2140 Forever 0.5(推理构造)

题目: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的圆上找点就行。

很巧妙的一道题目呀、、、、

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstdlib>
 4 #include <cstring>
 5 #include <cmath>
 6 #include <algorithm>
 7 using namespace std;
 8 
 9 double x[110], y[110];
10 void slo()
11 {
12     x[0] = 0; y[0] = 0;
13     x[1] = 1; y[1] = 0;
14     x[2] = 0.5; y[2] = sqrt(1-0.5*0.5);
15     x[3] = 0.5; y[3] = y[2]-1;
16     for(int i = 4; i < 102; i++)
17     {
18         x[i] = 1-0.001*i;
19         y[i] = sqrt(1-x[i]*x[i]);
20     }
21 }
22 int main()
23 {
24     int t, n;
25     cin>>t;
26     slo();
27     while(t--)
28     {
29         cin>>n;
30         if(n<=3)
31             cout<<"No"<<endl;
32         else
33         {
34             cout<<"Yes"<<endl;
35             for(int i = 0; i < n; i++)
36                 printf("%.6lf %.6lf\n", x[i], y[i]);
37         }
38     }
39     return 0;
40 }

 

转载于:https://www.cnblogs.com/bfshm/p/3619903.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值