**1051 - My-graph-同构图

本文探讨了图论中My-graph的概念及其构造方法。My-graph是一种特殊类型的图,其逆图与其自身同构。文章提出了一种判断是否能构造具有n个节点的My-graph的方法,并给出了具体的实现代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1051 - My-graph

Time Limit:1s Memory Limit:64MByte

Submissions:351Solved:171

DESCRIPTION

In graph theory, the inverse of a graph GG is a graph HH on the same vertices such that two distinct vertices of HH are adjacent if and only if they are not adjacent in GG.
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
nn nodes?

INPUT
There are multiple test cases.The first line is a number T (T 100T 100), which means the number of cases.For each case, one integer n(2n104)n(2n104) 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
code:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	int t,n,m,i,j;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		m=n*(n-1)/2;
		if(m%2==1)
		printf("no\n");
		else
		printf("yes\n");
	}
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值