您的位置:首页 > 其它

贪心/数学 2015百度之星资格赛 1004 放盘子

2015-06-01 19:27 323 查看
题目传送门

 /*
贪心:小度熊先在多边形中间放一个盘子,接下来无论来访者怎么放,小度熊都根据多边形中心与来访者的盘子对称着放就能获胜。
题目已经给出方法,就是能否把盘子放在多边形中间,那么和边心距比较
*/
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

const int MAXN = 1e3 + 10;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-6;
const int PI = acos (-1.0);

int main(void)        //2015百度之星资格赛 1004 放盘子
{
int t, cas = 0;    scanf ("%d", &t);
while (t--)
{
double n, a, r;
scanf ("%lf%lf%lf", &n, &a, &r);
double d = a / 2 / tan (PI/n);
printf ("Case #%d:\n", ++cas);
if (r + EPS < d)    puts ("Give me a kiss!");
else    puts ("I want to kiss you!");
}

return 0;
}

/*
2
4 50 2.5
4 5.5 3
*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: