HDU 1564 Play a game】的更多相关文章

n*n棋盘,初始左上角有一个石头,每次放只能在相邻的四个位置之一,不能操作者输. 如果以初始石头编号为1作为后手,那么对于每次先手胜的情况其最后一步的四周的编号必定是奇数,且此时编号为偶数,而对于一个局面,每个人都可以操控方向以致走完整个棋盘,所以当棋盘总格数为偶数时,先手必胜,而为奇数时,后手必胜. /** @Date : 2017-10-13 21:22:47 * @FileName: HDU 1564 简单博弈.cpp * @Platform: Windows * @Author : Lw…
HDU 1564 Play a game题意: 棋盘的大小是n*n.一块石头被放在一个角落的广场上.他们交替进行,8600人先走.每次,玩家可以将石头水平或垂直移动到一个未访问的邻居广场.谁不采取行动,谁就会输掉这场比赛.如果双方都打得很好,谁将赢得比赛? 题解: 三角形代表起始位置,虽然不是右上角但是解题都差不多 如果n为偶数,那么所有格子可以被2*1的砖块覆盖掉. 这样先手每次都移动到当前1*2的另外一块.先手必赢. 如果n为奇数.出了起始那个店,其余点都可以被覆盖. 代码: 1 #incl…
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 al…
这道题的答案猜也很好猜出来,但是想太难想了..题解一贴,然后闪人.. 请戳这…
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 chessboa…
题目:一个n*n的棋盘,每一次从角落出发,每次移动到相邻的,而且没有经过的格子上. 谁不能操作了谁输. 思路:看起来就跟奇偶性有关 走两步就知道了 #include <iostream> using namespace std; int main() { int n; while(cin>>n&&n) { )%!=) cout<<"<<endl; else cout<<"ailyanlu"<&l…
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,…
Play a game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1182    Accepted Submission(s): 969 Problem Description New Year is Coming! ailyanlu is very happy today! and he is playing a chessboa…
#include<stdio.h> int main() {  int n;  while(scanf("%d",&n),n) {   n=n*n-1;   if(n%2)    printf("8600\n");   else    printf("ailyanlu\n");  }  return 0; }…
题目大意是: 从n*n的方格角落的一个起点出发,每次移到上下左右一个未曾到达过的位置,谁不能走了谁就输了 想了好久都想不出,看了大神的题解 Orz了 果然博弈不是脑残的游戏啊... 这里从起点出发,将所有方格两两连接,如果为偶数,那么这个起点会有一个对应方格与其两两连接,那么起点说明已经占据了一格 那么每次先手只要走到当前格对应相连的格子上就保证可以有路,那么后手就输了 反之n为基数,那么没有点与起点相连,说明先手必然走入一个新的1*2的小长条中,那么后手始终有1*2的小长条的方格与其对应,所以…