zoukankan      html  css  js  c++  java
  • 贪心/数学 2015百度之星资格赛 1004 放盘子

    题目传送门

     1 /*
     2     贪心:小度熊先在多边形中间放一个盘子,接下来无论来访者怎么放,小度熊都根据多边形中心与来访者的盘子对称着放就能获胜。
     3     题目已经给出方法,就是能否把盘子放在多边形中间,那么和边心距比较
     4 */
     5 #include <cstdio>
     6 #include <algorithm>
     7 #include <cmath>
     8 #include <cstring>
     9 using namespace std;
    10 
    11 const int MAXN = 1e3 + 10;
    12 const int INF = 0x3f3f3f3f;
    13 const double EPS = 1e-6;
    14 const int PI = acos (-1.0);
    15 
    16 int main(void)        //2015百度之星资格赛 1004 放盘子
    17 {
    18     int t, cas = 0;    scanf ("%d", &t);
    19     while (t--)
    20     {
    21         double n, a, r;
    22         scanf ("%lf%lf%lf", &n, &a, &r);
    23         double d = a / 2 / tan (PI/n);
    24         printf ("Case #%d:
    ", ++cas);
    25         if (r + EPS < d)    puts ("Give me a kiss!");
    26         else    puts ("I want to kiss you!");
    27     }
    28 
    29     return 0;
    30 }
    31 
    32 
    33 /*
    34 2
    35 4 50 2.5
    36 4 5.5 3
    37 */
    编译人生,运行世界!
  • 相关阅读:
    16.14
    16.13
    JAVA JLabel自定义子类无法显示
    16.12
    16.11
    css实现垂直居中
    HTML5学习笔记
    HTML、Css中插入图片的一些问题
    MySQL的if函数
    java实现将汉字转为首字母、拼音
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4544716.html
Copyright © 2011-2022 走看看