Given an integer n, determine whether it is possible to dissect a regular hexagon into n parallelograms of equal area. An example of a hexagon dissected into 3 parallelograms is given below.
Input
There is at most 800 inputs. Each input is n (n < 1000001)
Output
For each input, output the answer on a single line. Output ‘1’ if it is possible to dissect a regular hexagon into n parallelograms, otherwise output ‘0’.
Sample Input
2
147
Sample Output
0
1
问题链接:UVA11298 Fantasy of a Summation
问题简述:(略)
问题分析:
找规律题,不解释。
程序说明:(略)
参考链接:(略)
题记:(略)
AC的C++语言程序如下:
/* UVA11298 Fantasy of a Summation */
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(~scanf("%d", &n))
printf(n % 3 == 0 && n > 2 ? "1\n" : "0\n");
return 0;
}