2015 Baidu STAR Program Design Competition, 2015 STAR Program Design

Source: Internet
Author: User

2015 Baidu STAR Program Design Competition, 2015 STAR Program Design

[Question link ]:Click here ~~

Du Xiong likes pranks. Today, he proposed a vulgar game to the visitors. He and the visitors take turns placing plates in a polygon. At last, the winner is the winner, who wins a kiss from the loser. After playing the game twice, he found that visitors knew the winning strategy of the game. Now he is always a pioneer and wants to know if he can win.

Note that the plates cannot interwork with the polygon or be placed outside the polygon. That is to say, the points in the plate cannot be outside the polygon or other plates.

[Solution] The Hint is the key to a mathematical problem, because he first places a plate in the middle of the polygon, and then whatever the visitor puts it, the little dual bears are symmetric Based on the center of the polygon and the visitor's plate to win ., Therefore, you only need to judge the diagonal length of the polygon and the plate radius (or diameter ).

Code:

# Include <stdio. h> # include <math. h> # include <string. h >#include <iostream >#include <algorithm> using namespace std; const int N = 1e5 + 5; int num [N]; const double eps = 1e-6; const double pi = acos (-1.0); int main () {int t, tot = 1; cin> t; while (t --) {double n, m, r; cin> n> m> r; printf ("Case # % d: \ n", tot ++); double ll = (m/2) /tan (pi/n); // polygon diagonal line length if (ll> r + eps) puts ("Give me a kiss! "); Else puts (" I want to kiss you! ");} Return 0 ;}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.