题目描述
Problem Background
NOIP2015 Junior Group T1
Problem Description
The king pays his loyal knights with gold coins. On the first day, the knight receives one coin; for the next two days (the second and third days), he receives two coins each day; for the next three days (the fourth, fifth, and sixth days), he receives three coins each day; for the next four days (the seventh, eighth, ninth, and tenth days), he receives four coins each day... This payment pattern continues indefinitely: after receiving \( n \) coins for \( n \) consecutive days, the knight will receive \( n+1 \) coins for the next \( n+1 \) consecutive days.
Calculate the total number of coins the knight has received in the first \( k \) days.
Input Format
A positive integer \( k \), representing the number of days for which coins are distributed.
Output Format
A positive integer, representing the total number of coins received by the knight.
Sample Input and Output
Sample Input #1
6
Sample Output #1
14
Sample Input #2
1000
Sample Output #2
29820
Notes
[Sample 1 Explanation]
The knight receives one coin on the first day; two coins each on the second and third days; three coins each on the fourth, fifth, and sixth days. Therefore, the total number of coins received is \( 1 + 2 + 2 + 3 + 3 + 3 = 14 \).
For \( 100\% \) of the data, \( 1 \le k \le 10^4 \).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分