Red John Game
来源:互联网 发布:斑马网络计划破解软件 编辑:程序博客网 时间:2024/05/22 16:56
Red John has a chess table of infinite dimensions, and n * n pawns, arranged in an n x n square. The pawns can be moved horizontally or vertically, buy jumping over an (horizontally or vertically) adjacent pawn, and onto the next position, only if this position is unoccupied by another pawn. Also, when a valid move occurs, the jumped pawn is removed. Can you help Red John figure out if there is a sequence of moves which leaves only one pawn on the table ?
Below, such a sequence of moves is illustrated, for n = 2. Pawns are depicted by the letter P.
Input
The program input is from a text file. Each file contains a value for n, with 0 < n < 10^9.
Output
The output consists of 1 if there is a sequence of moves leaving only one pawn on the table, and 0 otherwise. There cannot be any whitespace and newline characters in the output.
Sample Input
34Sample Output
01
//详求原理,有点模糊,L形相消,因为%3为1则为一个点,为2则可化为2个点,则不被3整除即可//一堆规律题啊 //1+3*k=n*n,不能让她往外走,要让她往内走 #include<iostream>#include<cstring>#include<cstdio>using namespace std;int main(){__int64 n; while(scanf("%I64d",&n)!=EOF){if(n%3==0)cout<<'0'<<endl;elsecout<<'1'<<endl;}return 0;}
- Red John Game
- Red John Game 规律思路题
- HDU 1907 John ( Nim Game )
- HDU 1907 John(Nim game)
- 【HackerRank】Red John is Back (Dynamic programming)简单递推
- John
- John
- John
- John
- ZOJ2507 Let's play a game,ZOJ3113 POJ3480 HDU1907 John,Anti-SG游戏
- POJ 2234 Matches Game/hdu 1907 John(尼姆博奕中取完胜与取完负的模板)
- POJ 2234 Matches Game/hdu 1907 John(尼姆博奕中取完胜与取完负)
- Red
- red
- John Carmack
- 《John Q》
- John感悟
- John感悟
- 统计学习那些事
- 带头结点链表的实现
- Codeforces Round #263 (Div. 2) proC
- android学习资源
- 用C# winform 编写一个计算器
- Red John Game
- 排序的时候一定要注意相等的情况。。
- [LeetCode OJ] Reverse Words in a String 解题报告
- Codeforces Round #263 (Div. 2)
- 2个有序链表的合并
- 如何使用Uglify2.js分析函数中的依赖项
- Russian Dolls
- 链表翻转
- char 字符范围