22169_Turnonthelights

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

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

Pro.ID

22169

Title

Turn on the lights

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    You are given a regular polygon of size n, and n is a positive odd number. At each vertex there is a light. Initially, all the lights are off. Now you want to turn all the lights on. When you push the button of one light, the light itself and the two lights which are opposite to it will change states(from on to off or from off to on). For example, n is 7, and the vertexes are numbered from 1 to 7. Then if you push the button of light 1, lights 1, 4, 5 will change states. In another case, you push the button of light 4, light 4, 1, 7 will change states. Now given n, please tell me the minimum times of pushing the buttons in order to turn all the lights on.

    输入

    For each test case, the input contains a single integer n. 3 ≤ n ≤ 1000, and n is odd.

    输出

    Description

    You are given a regular polygon of size n, and n is a positive odd number. At each vertex there is a light. Initially, all the lights are off. Now you want to turn all the lights on. When you push the button of one light, the light itself and the two lights which are opposite to it will change states(from on to off or from off to on). For example, n is 7, and the vertexes are numbered from 1 to 7. Then if you push the button of light 1, lights 1, 4, 5 will change states. In another case, you push the button of light 4, light 4, 1, 7 will change states. Now given n, please tell me the minimum times of pushing the buttons in order to turn all the lights on.

    Input

    For each test case, the input contains a single integer n. 3 ≤ n ≤ 1000, and n is odd.

    Output

    For each test case, output the answer in a single line.

    Sample Input

    5
    3

    Sample Output

    5

    Source

    样例输入

    5
    3

    样例输出

    5

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部