英语翻译Your task is so easy.I will give you an undirected graph,and you just need to tell me whether the graph is just a circle.A cycle is three or more nodes V1,V2,V3,...Vk,such that there are edges between V1 and V2,V2 and V3,...Vk and V1,with
来源:学生作业学帮网 编辑:学帮网 时间:2024/05/23 23:21:08
英语翻译
Your task is so easy.I will give you an undirected graph,and you just need to tell me whether the graph is just a circle.A cycle is three or more nodes V1,V2,V3,...Vk,such that there are edges between V1 and V2,V2 and V3,...Vk and V1,with no other extra edges.The graph will not contain self-loop.Furthermore,there is at most one edge between two nodes.
Input
There are multiple cases (no more than 10).
The first line contains two integers n and m,which indicate the number of nodes and the number of edges (1 < n < 10,1
你的任务很简单.我会给你一个无向图,你需要告诉我这个图标是否仅仅是个圆圈.一个圆圈有3个或3个以上的节点V1,V2,V3……Vk等等,这样一来,V1与V2,V2与V3,……Vk与V1间就会有很多条棱,并且不会有多余的棱.这个图标不会有自循环,两个节点间最多有一条棱.
输入
有很多种情况(不超过10)
第一条线包含两个整数n和m,表明节点的数量和节点之间棱的数量(1 < n < 10,1