• 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
    ", x[i], y[i]);
    37         }
    38     }
    39     return 0;
    40 }
  • 相关阅读:
    HDOJ/HDU 2352 Verdis Quo(罗马数字与10进制数的转换)
    HDOJ/HDU 2203 亲和串(简单的判断~Java的indexOf()方法秒)
    HDOJ/HDU 2163 Palindromes(判断回文串~)
    js之函数
    js琐碎知识点
    position
    css属性background
    图片展示失效容错处理
    文字打点
    浮动的一些知识点
  • 原文地址:https://www.cnblogs.com/bfshm/p/3619903.html
Copyright © 2020-2023  润新知