1051 - My-graph
Time Limit:1s Memory Limit:64MByte
Submissions:356Solved:175
DESCRIPTION
In graph theory, the inverse of a graph G
is a graph H on the same vertices such that two distinct vertices of H are adjacent if and only if they are not adjacent in G.
My-graph is the graph that it’s inverse graph is an isomorphism graph of itself.
(This is a example of My-graph has 5 nodes).
Now comes the problem: Do you have a way to make a My-graph that has n
nodes?
INPUT
There are multiple test cases.
The first line is a number T (T ≤100
), which means the number of cases. For each case, one integer n(2≤n≤104)
means the nodes you have initially.
OUTPUT
If you have at least one way to make it , please output “yes”.
If there is no way, output “no”.
SAMPLE INPUT
2
2
5
SAMPLE OUTPUT
no
yes
如果一个图有n个顶点,有n * (n - 1) / 2条可能的边。显然,一个图要想和自己互补,它里面的连线数必须是偶数
AC代码:
#include<cstdio>
int main()
{
int T,N;
scanf("%d",&T);
while(T--){
scanf("%d",&N);
if((N * (N - 1) / 2) & 1)
printf("no\n");
else
printf("yes\n");
}
return 0;
}