现在的位置: 首页 > 综合 > 正文

2011 Multi-University Training Contest 3 – Host by BIT No Gambling 也就是hdu 3863

2012年11月09日 ⁄ 综合 ⁄ 共 1793字 ⁄ 字号 评论关闭

这个题我是见识了博弈的妙处,虽然我不懂博弈,但是当我按照队友的想法a了这个题的时候,我很是吃惊,甚至敲得时候我都没有底气,好吧,废话少说,先看题!

原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3863

 

No Gambling
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65568/32768 K (Java/Others)
Total Submission(s): 721    Accepted Submission(s): 479


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~
 

Source
2011 Multi-University Training Contest 3 - Host by BIT 
 

Recommend
lcy

 

这个题当我看完的时候我傻了,想了好久都没想出来,后来队友说,由于棋盘是对称的,所以先手必胜,敲代码试试下面是我的代码:

#include <iostream>
using namespace std;

int main()
{
    int n;
    while(cin >> n && n != -1)
    {
        cout << "I bet on Oregon Maple~\n";
    }
    return 0;
}

这个代码是我敲得最短的,和a+b的代码差不多长吧,但是奇迹般的a了!!

抱歉!评论已关闭.