21359_Debug

2022-5-16 18:19| 发布者: Hocassian| 查看: 41| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505192871700-Problem List-采集的数据-后羿采集器.html

Pro.ID

21359

Title

Debug

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21359

AC

5

Submit

25

Ratio

20.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 6/65536 K (Java/Others)
  • 描述

    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
    4
    5

    Sample Output

    6
    8

    Hint

    The Solution of N = 4    

    Source

    样例输入

    2
    4
    5

    样例输出

    6
    8

    提示

    The Solution of N = 4    


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部