zoukankan      html  css  js  c++  java
  • HDU3863:No Gambling

    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~


     

    第一个人从左到右连接蓝点

    第二个人从上到下连接红点

    轮流进行

    看最后谁的线最多则赢

    我们可以发现,只要是先手,那么连的线一定是最多了,因此代码也就只有短短的几行

    #include <stdio.h>
    int main()
    {
        int n;
        while(scanf("%d",&n),n+1)
        puts("I bet on Oregon Maple~");
        return 0;
    }
    


     

  • 相关阅读:
    node.js 89行爬虫爬取智联招聘信息
    VUE2开发实战——搜索功能
    一个问题一份收获——请求回来的数据应该怎么处理
    JavaScript学习笔记(散)——继承、构造函数super
    讲解版的导航高亮(新手福利)原生JS
    关于node.js和npm,cnpm的安装记录以及gulp自动构建工具的使用
    HTML5中新添加事件
    javascript鸭式辩型法实现接口
    JS原型与原型链终极详解
    Javascript
  • 原文地址:https://www.cnblogs.com/riasky/p/3481845.html
Copyright © 2011-2022 走看看