21632_Xiaoshi'sProble

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

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

Pro.ID

21632

Title

Xiaoshi's Problem

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Xiaoshi is a silly boy, but he has a mathematical mind. Occasionally he will have some crazy idea on math problems. This time he gives out such a problem: Please work out the summation of the following formula, Sum = 1 + 2 + ... + n, which satisfies n ≤ 10100000.

    "Don't try to do a snow job on me. I know you couldn't solve it efficiently." I say to him.

    "Ah~~~ actually the formula is Sum = 1 + 2 + ... + 10n, which satisfies n ≤ 100000. Then can you effectively solve it?"

    输入

    There are multiple test cases. For each case, there is a line contains n which has been described above. ( 0 ≤ n ≤ 100000 )

    Input is terminated by one line contains "-1".

    输出

    Description

    Xiaoshi is a silly boy, but he has a mathematical mind. Occasionally he will have some crazy idea on math problems. This time he gives out such a problem: Please work out the summation of the following formula, Sum = 1 + 2 + ... + n, which satisfies n ≤ 10100000.

    "Don't try to do a snow job on me. I know you couldn't solve it efficiently." I say to him.

    "Ah~~~ actually the formula is Sum = 1 + 2 + ... + 10n, which satisfies n ≤ 100000. Then can you effectively solve it?"

    Input

    There are multiple test cases. For each case, there is a line contains n which has been described above. ( 0 ≤ n ≤ 100000 )

    Input is terminated by one line contains "-1".

    Output

    Output the summation corresponding to each input n.

    Sample Input

    1
    2
    -1

    Sample Output

    50
    5050

    Source

    样例输入

    1
    2
    -1

    样例输出

    50
    5050

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部