Red John Game

Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:65536KB
Total submit users: 20, Accepted users: 15
Problem 12902 : No special judgement
Problem description

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
3
4
Sample Output
0
1
//詳求原理,有點模糊,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;
		else
		cout<<'1'<<endl;
	}
	return 0;
} 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章