Coin Question
Source : ACM Group | |||
Time limit : 1 sec | Memory limit : 64 M |
Submitted : 234, Accepted : 131
Every HCPC(HIT Collegiate Programming Contest), Participants will check if Robin has set a problem. The reason is so obvious -- he has been so weak, how hard can his problem be.
This year, tradition goes on. You can solve this problem within one minute, or two minutes at most.
Here is the problem. Robin has a round table with radius R (0.00 <= R <= 100000000.00), and a lot of same coins (you can assume they are infinite) with radius r (0.00 <= r <= 10000.00). Robin invites two friends, Mr. Wendy and Mr. Pian, to play a game. Rules are as follows.
1. Mr. Wendy and Mr. Pian take turns to place one coin on the table. Mr. Wendy first.
2. One can place the coin anywhere on the table, but he can't place it on any other coins, even one corner is not allowed.
3. One can't let the coin which he places hang in the air, which means any part of the coin must be close to the table's surface.
4. The person who can't place a coin on the table loses the game.
Input
The input data are of various cases.Each case consists of two float numbers. Round table's radius R and the coin's radius r.The input ends with EOF.
Output
For each case, If Mr. Wendy wins the game, you should output a line:
Yes, Mr. Wendy is a ****ing genius!
Or, you should output the line:
No, Mr. Pian is the real ****ing genius!
Sample Input
4.00 4.00 4.00 5.00
Sample Output
Yes, Mr. Wendy is a ****ing genius! No, Mr. Pian is the real ****ing genius!
题解:R为r的奇数倍的时候,可以摆放如下,第一次选择中间的一个(以大圆的圆心为我们放置硬币的圆心),然后对方在任何位置放,我们
都往圆心的对称位置上放硬币,由于对称性,若对方能够放下一个硬币的话,必定存在一个对称的位置可供我们放
R为r的偶数倍的时候,如下放置,那我们第一次可以在四个最靠近圆心的并以圆心为半径的位置上放上我们第一颗硬币,然后由于中间的4颗
硬币所在的位置都不能放了,然后根据对手每次放的位置,采取上面的对称放置策略,必定存在某个位置使得我们可以方下我们要放的硬币
所以每次只要R大于r,我们必赢。。。