22860_SumtoN

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

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

Pro.ID

22860

Title

Sum to N

Title链接

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

AC

52

Submit

140

Ratio

37.14%

时间&空间限制

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

    Find all ways + or - can be substituted for the @ symbol in a prototype equation like the one below such that the expression is true for a specified N (4 ≤ N ≤ 24).  Count the number of distinct arrangements.

    -1 @ 2 @ 3 @ 4 @ 5 ... @ N-2 @ N-1 = N

    输入

    多测试用例。

    A single line with the integer N.

    输出

    Description

    Find all ways + or - can be substituted for the @ symbol in a prototype equation like the one below such that the expression is true for a specified N (4 ≤ N ≤ 24).  Count the number of distinct arrangements.

    -1 @ 2 @ 3 @ 4 @ 5 ... @ N-2 @ N-1 = N

    Input

    多测试用例。

    A single line with the integer N.

    Output

    A single line with the integer that is the number of distinct ways the expression can be made true.

    Sample Input

    8

    Sample Output

    4

    Hint

    Namely:

    -1 - 2 - 3 - 4 + 5 + 6 + 7 = 8

    -1 - 2 + 3 + 4 + 5 + 6 - 7 = 8

    -1 + 2 - 3 + 4 + 5 - 6 + 7 = 8

    -1 + 2 + 3 - 4 - 5 + 6 + 7 = 8

    Source

    样例输入

    8

    样例输出

    4

    提示

    Namely:

    -1 - 2 - 3 - 4 + 5 + 6 + 7 = 8

    -1 - 2 + 3 + 4 + 5 + 6 - 7 = 8

    -1 + 2 - 3 + 4 + 5 - 6 + 7 = 8

    -1 + 2 + 3 - 4 - 5 + 6 + 7 = 8


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部