(博弈) HOJ 2939 Coin Question

Coin Question

My Tags  (Edit)
Source : ACM Group
Time limit : 1 secMemory limit : 64 M

Submitted : 360, Accepted : 194

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的硬币,然后两个人轮流在桌子上面放硬币,最后放不了硬币的人输。

思路:如果能想到还是很简单的,首先先放的人是能必定能赢得,如果一开始他能放的话,先放的人的策略是直接把一个硬币放在中心,然后对方放在哪里我们就放在他放的位置的中心对称的地方,那么最后一定是对方放不下。
所以要自己输只有当硬币的大小比桌子大的时候才会输。

代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string.h>
using namespace std;
#define eps 1e-8
int main()
{
double R , r;
while (cin>>R>>r)
{
if (R < r) printf("No, Mr. Pian is the real ****ing genius!\n");
else  printf("Yes, Mr. Wendy is a ****ing genius!\n");
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值