ACM学习历程—BestCoder 2015百度之星资格赛1004 放盘子(策略 && 计算几何)
在Hint已经说明。
只需要首先在中心放盘子,然后来访者无论怎么放,小度熊自然可以对称来放。
所以只要第一个能放下是必胜的。
第一个判断就是判断中心点到多边形边的距离和盘子半径进行比较。
代码:
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <deque> #include <map> #include <set> #include <string> #define LL long long using namespace std; const double PI = acos(-1); int main() { //freopen("test.in", "r", stdin); int T, n; double a, r; scanf("%d", &T); for (int times = 1; times <= T; ++times) { printf("Case #%d:\n", times); scanf("%d%lf%lf", &n, &a, &r); if (a/2/tan(PI/n) <= r) printf("I want to kiss you!\n"); else printf("Give me a kiss!\n"); } return 0; }
把每一道题当作难题去做。
posted on 2015-05-25 21:11 AndyQsmart 阅读(270) 评论(0) 编辑 收藏 举报