AtCoder Beginner Contest 139
翻译中…
Problem Statement
翻译中…
For an integer $N$, we will choose a permutation $\{P_1, P_2, ..., P_N\}$ of $\{1, 2, ..., N\}$.
翻译中…
Then, for each $i=1,2,...,N$, let $M_i$ be the remainder when $i$ is divided by $P_i$.
翻译中…
Find the maximum possible value of $M_1 + M_2 + \cdots + M_N$.
翻译中…
Constraints
翻译中…
$N$is an integer satisfying$1 \leq N \leq 10^9$.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
翻译中…
Output
翻译中…
Print the maximum possible value of $M_1 + M_2 + \cdots + M_N$.
翻译中…
样例
Input #1
2
Output #1
1
When the permutation $\{P_1, P_2\} = \{2, 1\}$ is chosen, $M_1 + M_2 = 1 + 0 = 1$.
Input #2
13
Output #2
78
Input #3
1
Output #3
0
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。