
一道acm的题,求解题意,没明白要干啥?
ProblemDescriptionAsastudentincomputerscience,AntisweakinGraphTheorylearning.Oneday,h...
Problem Description
As a student in computer science, Ant is weak in Graph Theory learning. One day, he comes across a problem. Given a non-directed graph G which is donated by G = {V, E}. V is the set of vertexes and E is the set of undirected edges. You should select some vertexes as key vertexes and each edge should be connected by at least one key vertex. Ant sometimes can select the key vertexes as described above. But now he wants to select least vertexes as key vertexes. Here comes your question, given a graph and tell Ant how many ways are there to select least key vertexes.
Input
The first line of the input contains an integer T which is the number of test case, and then there are T groups of data following. For each group of data, the first line contains two integers. The first integer n is the number of vertexes and the second integer m is the number of edges. The next following m lines describe the edges. Each line contains two integers u, v which indicates there is an undirected edge connected vertex u and vertex v. (0 < n ≤ 20, 0 < m ≤ 300, u ≠ v, 1 ≤ u, v ≤ n)
Output
For each test case, output an integer which is the number of ways that selecting least key vertexes.
Sample Input
1
4 3
1 2
2 3
3 4
Sample Output
3
Hint
For the sample, there are three ways, which are selecting {1, 3}, {2, 4}, {2, 3} 展开
As a student in computer science, Ant is weak in Graph Theory learning. One day, he comes across a problem. Given a non-directed graph G which is donated by G = {V, E}. V is the set of vertexes and E is the set of undirected edges. You should select some vertexes as key vertexes and each edge should be connected by at least one key vertex. Ant sometimes can select the key vertexes as described above. But now he wants to select least vertexes as key vertexes. Here comes your question, given a graph and tell Ant how many ways are there to select least key vertexes.
Input
The first line of the input contains an integer T which is the number of test case, and then there are T groups of data following. For each group of data, the first line contains two integers. The first integer n is the number of vertexes and the second integer m is the number of edges. The next following m lines describe the edges. Each line contains two integers u, v which indicates there is an undirected edge connected vertex u and vertex v. (0 < n ≤ 20, 0 < m ≤ 300, u ≠ v, 1 ≤ u, v ≤ n)
Output
For each test case, output an integer which is the number of ways that selecting least key vertexes.
Sample Input
1
4 3
1 2
2 3
3 4
Sample Output
3
Hint
For the sample, there are three ways, which are selecting {1, 3}, {2, 4}, {2, 3} 展开
展开全部
Problem Description
As a student in computer science, Ant is weak in Graph Theory learning.
ant是一个计算机专业的学生,但是他图论学习的不是很好。
One day, he comes across a problem.
有一天,他被一个问题困扰了。
Given a non-directed graph G which is donated by G = {V, E}. V is the set of vertexes and E is the set of undirected edges.
问题是这样的,给一个无向图G,G={V,E},V是图的点集,E是图的边集
You should select some vertexes as key vertexes and each edge should be connected by at least one key vertex.
你要做的就是从这些点中选择一些点作为关键点,然后使得所有的边要至少和一个关键点相连
Ant sometimes can select the key vertexes as described above.
ant有时候可以做出这个问题
But now he wants to select least vertexes as key vertexes.
但是他想使选择的点最少
Here comes your question, given a graph and tell Ant how many ways are there to select least key vertexes.
现在这个问题交给你,给定图然后你告诉ant有多少种方法可以选择最少的关键点。
Input
The first line of the input contains an integer T which is the number of test case,
输入数据的第一行包括一个T,意思表示的是有多少个测试数据
and then there are T groups of data following.
然后后面有T组数据
For each group of data,
对于每一组数据
the first line contains two integers.
第一行包括两个整数
The first integer n is the number of vertexes and the second integer m is the number of edges.
第一个整数以n表示的是点数,第二个整数是m表示的是边数
The next following m lines describe the edges.
接下来m行给出边
Each line contains two integers u, v which indicates there is an undirected edge connected vertex u and vertex v. (0 < n ≤ 20, 0 < m ≤ 300, u ≠ v, 1 ≤ u, v ≤ n)
每一行包括两个正整数,表示的是一条边的两个端点
Output
For each test case, output an integer which is the number of ways that selecting least key vertexes.
对于每一个测试数据,输出一个整数表示有多少种方法可以选择最少的关键点。
Sample Input
1
4 3
1 2
2 3
3 4
Sample Output
3
Hint
For the sample, there are three ways, which are selecting {1, 3}, {2, 4}, {2, 3}
对于这个例子,有三种方法,他们是{1, 3}, {2, 4}, {2, 3}
As a student in computer science, Ant is weak in Graph Theory learning.
ant是一个计算机专业的学生,但是他图论学习的不是很好。
One day, he comes across a problem.
有一天,他被一个问题困扰了。
Given a non-directed graph G which is donated by G = {V, E}. V is the set of vertexes and E is the set of undirected edges.
问题是这样的,给一个无向图G,G={V,E},V是图的点集,E是图的边集
You should select some vertexes as key vertexes and each edge should be connected by at least one key vertex.
你要做的就是从这些点中选择一些点作为关键点,然后使得所有的边要至少和一个关键点相连
Ant sometimes can select the key vertexes as described above.
ant有时候可以做出这个问题
But now he wants to select least vertexes as key vertexes.
但是他想使选择的点最少
Here comes your question, given a graph and tell Ant how many ways are there to select least key vertexes.
现在这个问题交给你,给定图然后你告诉ant有多少种方法可以选择最少的关键点。
Input
The first line of the input contains an integer T which is the number of test case,
输入数据的第一行包括一个T,意思表示的是有多少个测试数据
and then there are T groups of data following.
然后后面有T组数据
For each group of data,
对于每一组数据
the first line contains two integers.
第一行包括两个整数
The first integer n is the number of vertexes and the second integer m is the number of edges.
第一个整数以n表示的是点数,第二个整数是m表示的是边数
The next following m lines describe the edges.
接下来m行给出边
Each line contains two integers u, v which indicates there is an undirected edge connected vertex u and vertex v. (0 < n ≤ 20, 0 < m ≤ 300, u ≠ v, 1 ≤ u, v ≤ n)
每一行包括两个正整数,表示的是一条边的两个端点
Output
For each test case, output an integer which is the number of ways that selecting least key vertexes.
对于每一个测试数据,输出一个整数表示有多少种方法可以选择最少的关键点。
Sample Input
1
4 3
1 2
2 3
3 4
Sample Output
3
Hint
For the sample, there are three ways, which are selecting {1, 3}, {2, 4}, {2, 3}
对于这个例子,有三种方法,他们是{1, 3}, {2, 4}, {2, 3}
展开全部
问题描述
作为一名学生,在计算机科学中,Ant是弱的图论学习。有一天,他遇到的一个问题。给定一个非定向捐赠的图G,G ={V,E}。V是顶点集,E是无向边集。你应该选择一些为重点顶点的顶点,每条边应至少有一个关键点连接。蚂蚁有时可以选择如上所述的关键顶点。但现在,他要选择至少为重点顶点顶点。来了你的问题,给定一个图,告诉Ant有多少种方法来选择最不关键的顶点。
输入
输入的第一行包含一个整数T,这是多少的测试的情况下,然后有数据之后的T基团。对于每个组的数据,在第一行包含两个整数。第一整数n是顶点的数目和第二整数m是的边的数目。下一个m行描述的边缘。每行包含两个整数U,V,这表明有一个无向边连接的顶点u和顶点v(0 <N≤20,0<M≤300,U≠V,1≤U,V≤N)
产量
对于每个测试用例,输出一个整数,这是多少的方式,选择最不关键顶点。
样例输入
1
4 3
1 2
2 3
3 4
样本输出
3
暗示
对于本示例,有三种方法,其中选择{1,3},{2,4},{2,3}
作为一名学生,在计算机科学中,Ant是弱的图论学习。有一天,他遇到的一个问题。给定一个非定向捐赠的图G,G ={V,E}。V是顶点集,E是无向边集。你应该选择一些为重点顶点的顶点,每条边应至少有一个关键点连接。蚂蚁有时可以选择如上所述的关键顶点。但现在,他要选择至少为重点顶点顶点。来了你的问题,给定一个图,告诉Ant有多少种方法来选择最不关键的顶点。
输入
输入的第一行包含一个整数T,这是多少的测试的情况下,然后有数据之后的T基团。对于每个组的数据,在第一行包含两个整数。第一整数n是顶点的数目和第二整数m是的边的数目。下一个m行描述的边缘。每行包含两个整数U,V,这表明有一个无向边连接的顶点u和顶点v(0 <N≤20,0<M≤300,U≠V,1≤U,V≤N)
产量
对于每个测试用例,输出一个整数,这是多少的方式,选择最不关键顶点。
样例输入
1
4 3
1 2
2 3
3 4
样本输出
3
暗示
对于本示例,有三种方法,其中选择{1,3},{2,4},{2,3}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询