Pro.ID21661 TitleAirport Connecting Management Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21661 AC22 Submit25 Ratio88.00% 时间&空间限制描述There is a very beautiful country called ICPC (International Cleanest and Prettiest Country). It's really very clean and pretty, but not so convenient in traffic. This year, you are hired to take the following task called ACM (Airport Connecting Management): There are N cities in ICPC. Each city has exactly one airport. At first, there are no flights between them. You are asked to connect these airports by adding flights. The schedule must follow these rules: (1) Each flight is a two-way service that directly connects two airports. (2) No pair of airports can be connected by more than one flight. (3) From a city, you can go to every other city by at most two flights (go directly or transfer by an intermediate city). Here comes the problem: What's the minimum number of flights you need to add to obey these rules? 输入There are multiple test cases in this problem. The first line contains an integer T ( 1 ≤ T ≤ 10 ) telling the number of test cases. Each test case is an integer N ( 2 ≤ N ≤ 50 ) in a line indicating the number of cities. 输出Description There is a very beautiful country called ICPC (International Cleanest and Prettiest Country). It's really very clean and pretty, but not so convenient in traffic. This year, you are hired to take the following task called ACM (Airport Connecting Management): There are N cities in ICPC. Each city has exactly one airport. At first, there are no flights between them. You are asked to connect these airports by adding flights. The schedule must follow these rules: (1) Each flight is a two-way service that directly connects two airports. (2) No pair of airports can be connected by more than one flight. (3) From a city, you can go to every other city by at most two flights (go directly or transfer by an intermediate city). Here comes the problem: What's the minimum number of flights you need to add to obey these rules? Input There are multiple test cases in this problem. The first line contains an integer T ( 1 ≤ T ≤ 10 ) telling the number of test cases. Each test case is an integer N ( 2 ≤ N ≤ 50 ) in a line indicating the number of cities. Output For each test case, output an integer telling the minimum number of flights in a line. Sample Input 2 Sample Output 1 Source 样例输入2 样例输出1 作者 |