Sign in $ create-account
~/problems ~/discussion ~/contests ~/submission
← ~/problems
P2016

Triangular Number

Easy
// Description
Output the sum 1 + 2 + ... + n.
// Input
A single integer n (1 <= n <= 10^9).
// Output
The value of n(n+1)/2.
// Hint
Use the closed-form formula; mind 64-bit overflow.
// Samples
Sample Input
10
Sample Output
55
// Problem Info
DifficultyEasy
Acceptance70%
Time Limit1000 ms
Memory Limit65536 KB
Accepted7