文件名称:B_xuanba
介绍说明--下载内容均来自于网络,请自行研究使用
第四届华为杯程序设计竞赛B题。问题输入
输入包括多个测试用例,首先给出测试用例数N,接着给出N个测试用例,1≤N≤100。
每一个测试用例包括M+1行,首先给出两个整数K和M;再依次给出M行,每行给出两个不同正整数i和j,表示两个不同亲友i和j属于同一亲友团,i≠j,1≤i≤K,1≤j≤K,,1≤K≤10000,1≤M≤10000。
问题输出
输出包括多行,对于每个测试用例,输出一行,给出至多需要划分出的独立区域数量。
样例输入
2
3 1
1 2
3 2
1 2
2 3
样例输出
2
1
-Problem input
Inputs include multiple test cases, test cases given first number N, then given N test cases, 1 ≤ N ≤ 100.
Each test includes M+1 rows, first give two integers K and M then in turn gives M lines, each given two different positive integers i and j, represent two different i and j belong to the same family and friends friends and relatives, i ≠ j, 1 ≤ i ≤ K, 1 ≤ j ≤ K,, 1 ≤ K ≤ 10000,1 ≤ M ≤ 10000.
Problem Output
The output includes a multi-line, for each test case, output a line, given the number of independent regional division of the most needed.
Sample Input
2
31
12
32
12
23
Sample Output
2
1
输入包括多个测试用例,首先给出测试用例数N,接着给出N个测试用例,1≤N≤100。
每一个测试用例包括M+1行,首先给出两个整数K和M;再依次给出M行,每行给出两个不同正整数i和j,表示两个不同亲友i和j属于同一亲友团,i≠j,1≤i≤K,1≤j≤K,,1≤K≤10000,1≤M≤10000。
问题输出
输出包括多行,对于每个测试用例,输出一行,给出至多需要划分出的独立区域数量。
样例输入
2
3 1
1 2
3 2
1 2
2 3
样例输出
2
1
-Problem input
Inputs include multiple test cases, test cases given first number N, then given N test cases, 1 ≤ N ≤ 100.
Each test includes M+1 rows, first give two integers K and M then in turn gives M lines, each given two different positive integers i and j, represent two different i and j belong to the same family and friends friends and relatives, i ≠ j, 1 ≤ i ≤ K, 1 ≤ j ≤ K,, 1 ≤ K ≤ 10000,1 ≤ M ≤ 10000.
Problem Output
The output includes a multi-line, for each test case, output a line, given the number of independent regional division of the most needed.
Sample Input
2
31
12
32
12
23
Sample Output
2
1
(系统自动生成,下载前可以参看下载内容)
下载文件列表
B_xuanba.doc