問題一覧 > 通常問題

No.2937 Sigma Plus Problem

レベル : / AI推定難易度 : 147 / 実行時間制限 : 1ケース 0.300秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 178
作問者 : kazuppa / テスター : yuusaan kakao745 hirayuu_yc
お気に入りにしたユーザー ProblemId : 11334 / 自分の提出
問題文最終更新日: 2025-02-16 22:48:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 450 (順位表) の他の問題:

Short Story

Once upon a time, somewhere, there lived an amazing, amazing coder.

That person spoke the following words, which had a great influence on later generations.

"Listen, a computer can only perform about $10^9$ calculations per second, even in a fast language. If it computes any more than that, it will get TLE."

Problem Statement

You are given a positive integer $N$.

Find $\displaystyle\sum_{i=1}^N i$.

Note that the execution time limit for each test case is 0.3 seconds.

Also, under the constraints of this problem, the answer may not fit in a 32-bit integer or a signed 64-bit integer. The answer does fit in an unsigned 64-bit integer or a multiple-precision integer, so we strongly recommend using a type that can handle such numbers.

(In C++, types such as unsigned long long can handle unsigned 64-bit integers.)

Input

The input is given from standard input in the following format.
$N$

Constraints

  • $1\le N\le 5\times 10^9$
  • $N$ is an integer

Output

Print the answer on one line.

End the output with a newline.

Sample

Sample 1
Input
3
Output
6

Since $\sum_{i=1}^3 i=1+2+3=6$, print $6$.

Sample 2
Input
1
Output
1

Sample 3
Input
2500000000
Output
3125000001250000000

The answer may not fit in a 32-bit type.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。