Play a game

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1030    Accepted Submission(s): 838

Problem Description
New Year is Coming! 
ailyanlu is very happy today! and he is playing a chessboard game with 8600. 
The size of the chessboard is n*n. A stone is placed in a corner square. They play alternatively with 8600 having the first move. Each time, player is allowed to move the stone to an unvisited neighbor square horizontally or vertically. The one who can't make a move will lose the game. If both play perfectly, who will win the game?
 
Input
The input is a sequence of positive integers each in a separate line. 
The integers are between 1 and 10000, inclusive,(means 1 <= n <= 10000) indicating the size of the chessboard. The end of the input is indicated by a zero.
 
Output
Output the winner ("8600" or "ailyanlu") for each input line except the last zero. 
No other characters should be inserted in the output.
 
Sample Input
2
0
 
Sample Output
8600
 
Author
ailyanlu
 
Source
 
Recommend
8600

从一个n*n的角落出发,每次移动到相邻的,而且没有经过的格子上。谁不能操作了谁输。

结论就是n为偶数,先手赢,奇数,后手赢。

可以看下图

S表示起点。

如果n为偶数,那么所有格子可以被2*1的砖块覆盖掉。

这样先手每次都移动到当前1*2的另外一块。先手必赢。

如果n为奇数。出了起始那个店,其余点都可以被覆盖。

所有后手赢

#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)== &&n)
{
if(n%==)printf("8600\n");
else printf("ailyanlu\n");
}
return ;
}

HDU 1564 Play a game (找规律博弈)的更多相关文章

  1. 题解报告:hdu 1564 Play a game(找规律博弈)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1564 Problem Description New Year is Coming! ailyanlu ...

  2. HDU 3032 multi-sg 打表找规律

    普通NIM规则加上一条可以分解为两堆,标准的Multi-SG游戏 一般Multi-SG就是根据拓扑图计算SG函数,这题打表后还能发现规律 sg(1)=1 sg(2)=2 sg(3)=mex{0,1,2 ...

  3. hdu 1030 Delta-wave(数学题+找规律)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1030 Delta-wave Time Limit: 2000/1000 MS (Java/Others ...

  4. 2017EC Final L SOS——找规律&&博弈

    题意 有n个格子排成一行,两人轮流填,可填入"S"或"0",先得到"SOS"的人胜:如果全部填完也没有出现"SOS",则 ...

  5. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  6. HDU 4910 Problem about GCD 找规律+大素数判断+分解因子

    Problem about GCD Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  7. HDU 4572 Bottles Arrangement(找规律,仔细读题)

    题目 //找规律,123321123321123321…发现这样排列恰好可以错开 // 其中注意题中数据范围: M是行,N是列,3 <= N < 2×M //则猜测:m,m,m-1,m-1 ...

  8. HDU 1041 Computer Transformation(找规律加大数乘)

    主要还是找规律,然后大数相乘 #include<stdio.h> #include<string.h> #include<math.h> #include<t ...

  9. HDU 5793 A Boring Question (找规律 : 快速幂+乘法逆元)

    A Boring Question Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others ...

  10. HDU 1391 number steps(找规律,数学)

    Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown ...

随机推荐

  1. Android在OnCreate中获取控件的宽度和高度

    在Android中,有时需要对控件进行测量,得到的控件宽度和高度可以用来做一些计算.在需要自适应屏幕的情况下,这种计算就显得特别重要.另一方便,由于需求的原因,希望一进入界面后,就能得到控件的宽度和高 ...

  2. echarts地图点定位的问题

    1,生成地图 2,如果需要产生地图上的点位,需要在配置中传入geoCoord具体数据为一下: { "海门": [121.15, 31.89], "鄂尔多斯": ...

  3. CodeForces ZeptoLab Code Rush 2015

    拖了好久的题解,想想还是补一下吧. A. King of Thieves 直接枚举起点和5个点之间的间距,进行判断即可. #include <bits/stdc++.h> using na ...

  4. UVa 10474 Where is the Marble

    题意:给出一列数,先排序,再查找学习了sort函数,lower_bound函数sort:可以给任意对象排序(包括自己定义的)(前提是定义好了‘<’运算符)lower_bound:查找大于或者等于 ...

  5. scala学习笔记(5)

    偏应用函数 举个例子 def sum(a: Int, b: Int, c: Int) = a + b + c val a = sum _ println(a(1,2,3)) 实际发生的事情是这样的:名 ...

  6. XE7 - 程序图标及启动画面图片的注意事项

    还是继续昨晚写的,年前已经解决了这个问题,现在补记下.启动画面失真是本篇笔记的重点.搜索了很多文章,基本上大同小异,几乎都没怎么提及启动画面失真的问题.不知道是不是我的操作不对头,. Project ...

  7. Centos移除图形界面

    在此之前为了试验SAS Linux,在一台centos服务器上安装了desktop界面, 目前需要删除这些界面组件,可以按照以下步骤实现: 1. yum grouplist查看安装的组件 2. 使用y ...

  8. 2015-10-14 晴 tcp/ip

    今天看完ping, traceroute, ip选路,动态选路协议,dup, igmp, tftp, bootp,tcp

  9. CentOS 安装BitTorrent Sync详细步骤

    官网:https://www.getsync.com 这个软件安装完后通过网页浏览器设置共享目录并生成同步Secret,异地的客户端可以通过这个同步Secret访问共的目录,其中有读写和只读两种同步方 ...

  10. xsheell的下载安装初级使用

    1)关于Xshell 网上更多的资料里提到的SSH客户端是putty,因为简单.开源.免费.但是也正是由于功能过于简单,所以在这里推荐大家使用Xshell. Xshell最初并不能免费使用,而且也没有 ...