P27802 [洛谷] Sum Calculation
普及-
题目描述

Problem Description

Given an integer $n(1\le n \le 10^7)$, output the sum of numbers from 1 to $i$ for each line.

For example, when $n=5$:

  • The 1st line outputs the number 1;
  • The 2nd line outputs the number 3, because 1 + 2 = 3;
  • The 3rd line outputs the number 6, because 1 + 2 + 3 = 6;
  • The 4th line outputs the number 10, because 1 + 2 + 3 + 4 = 10;
  • The 5th line outputs the number 15, because 1 + 2 + 3 + 4 + 5 = 15.

Input Format

Input consists of a single integer $n(1\le n \le 10^7)$.

Output Format

Output consists of $n$ lines, each containing a single integer.

The integer on the $i$-th line represents the sum of numbers from 1 to $i$.

Sample Input and Output

Sample Input #1

2

Sample Output #1

1
3

Sample Input #2

5

Sample Output #2

1
3
6
10
15

Notes

  • For 40% of the test cases, $1\le n \le 10$.
  • For 60% of the test cases, $1\le n \le 10^4$.
  • For 80% of the test cases, $1\le n \le 10^6$.
  • For 100% of the test cases, $1\le n \le 10^7$.

Hints:

Using cout << endl; for line breaks may result in TLE (Time Limit Exceeded).

Please use cout << "$\n$"; or printf("$\n$"); for line breaks instead.

The value of $1+2+3+\dots+10000000$ exceeds the maximum value that can be stored in an int type.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2
样例输出
1 3