【hdu 3863】No Gambling

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65568/32768 K (Java/Others)
Total Submission(s): 1716 Accepted Submission(s): 1243

Problem Description
One day, Flyvan introduced a new game to his two friends, Oregon Maple and Grape Skin. The game is quite simple. Given an N-sized grids, like the figure A shown below (as N = 4). The blue points are the places the first player can choose, and the red points are the places the second player can choose.

这里写图片描述
In the game, the two players take turns to choose two points to get connected by a stick. The two chosen points’ distance should be exactly one-unit length. The first player’s goal is to create a ‘bridge’ that connects a most left point and a most right point. The second player’s goal is to create a ‘bridge’ that connects a most top point and a most bottom point. Figure B shows a possible result (the first player won). In addition, the stick shouldn’t get crossed.
Now Flyvan will give the number N, and his two friends will play the game. Both of the two players will choose the best strategy. You can bet on one player, and if he wins the game, you’ll get twice money you bet~
Since you are a talented programmer, you surely won’t just do gambling. Please write a program to find out the player who you should bet on. As Oregon Maple is elder, he will always play first.

Input
Each line of the input is an integer N (2 <= N <= 270000), which indicated the number Flyvan chose. The end-of-file is denoted by a single line containing the number -1.

Output
If you think the first player will win, please output “I bet on Oregon Maple~”, else please output “I bet on Grape Skin~”.

Sample Input
2
-1

Sample Output
I bet on Oregon Maple~

【题目链接】:http://acm.hdu.edu.cn/showproblem.php?pid=3863

【题解】

画了N=3和N=4的情况;
(奇数和偶数的棋盘都是一样的);
(都是相同的模式:一个横着放一个竖着放);
模拟了一下发现红色的线堵不住蓝色的线。
不信你自己试试。。
所以都输出Maple就好。。(先手赢);

【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%I64d",&x)

typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

//const int MAXN = x;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);

int n;

int main()
{
    //freopen("F:\rush.txt","r",stdin);
    while (~scanf("%d",&n))
    {
        if (n==-1)
            break;
        puts("I bet on Oregon Maple~");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/AWCXV/p/7626731.html