Pro.ID21359 TitleDebug Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21359 AC5 Submit25 Ratio20.00% 时间&空间限制描述Bob is a bad programmer. His code is full of bugs. So he wants to generate some test cases and find what is wrong with his code. Inputs of the problem are undirected graphs that MUST obey the following rule: Assume that v is one node of graph G, and N(v) = { w | e(w, v) ∈ E(G) } If the degree of v is not 3, then degree of all the nodes in N(v) is 3. Could you tell Bob the maximum number of edges of a graph with N nodes? 输入The first line of the input is a positive integer T. T is the number of the test cases followed Each test case contains an integer N ( 3 < N < 1000000 ) which is the number of nodes of the graph G. There may be one or several spaces before or after the integer. 输出Description Bob is a bad programmer. His code is full of bugs. So he wants to generate some test cases and find what is wrong with his code. Inputs of the problem are undirected graphs that MUST obey the following rule: Assume that v is one node of graph G, and N(v) = { w | e(w, v) ∈ E(G) } If the degree of v is not 3, then degree of all the nodes in N(v) is 3. Could you tell Bob the maximum number of edges of a graph with N nodes? Input The first line of the input is a positive integer T. T is the number of the test cases followed Each test case contains an integer N ( 3 < N < 1000000 ) which is the number of nodes of the graph G. There may be one or several spaces before or after the integer. Output The output of the program should consist of one line of output for each test case. The output of each test case only contains an integer which is the maximum number of the edges of G. No any redundant spaces is needed. Sample Input 2 Sample Output 6 Hint The Solution of N = 4 Source 样例输入2 样例输出6 提示The Solution of N = 4 |