#C5488. Minimum Candies Distribution
Minimum Candies Distribution
Minimum Candies Distribution
You are given a single integer N representing the number of students. Your task is to compute the minimum number of candies required such that no two students receive the same number of candies. The optimal way to distribute the candies is to give out 1 candy to the first student, 2 candies to the second student, up to N candies for the N-th student.
The answer can be computed using the formula for the sum of the first N natural numbers:
\( \frac{N(N+1)}{2} \)
For example, if N = 3, the minimum number of candies required is 6.
inputFormat
The input consists of a single integer N (1 \(\leq N \leq 10^9\)) representing the number of students.
outputFormat
Output a single integer which is the minimum number of candies needed such that no two students receive the same number of candies. The result is computed as \(\frac{N(N+1)}{2}\).
## sample3
6