P25371 [AtCoder] Exactly N points
普及
题目描述

Problem Description

In the final round of CODE FESTIVAL in a certain year, $ N $ problems were presented.

The score for the $i\ (1≦i≦N)$ th problem is $ i $ points.

Takahashi wants to score exactly $ N $ points in this contest and is thinking about which problems to solve.

Since higher-scoring problems are more difficult, he decided to minimize the maximum score among the problems he solves.

Determine the set of problems Takahashi should solve.

Input Format

The input is given from the standard input in the following format:

$ N $

Output Format

Determine a set where the total score is exactly $ N $ and the maximum score is minimized, and output the indices of the problems included in this set, one per line. The output does not need to be in ascending order.

If multiple such sets are possible, any one of them may be output.

Sample Input and Output

Sample Input #1

4

Sample Output #1

1
3

Sample Input #2

7

Sample Output #2

1
2
4

Sample Input #3

1

Sample Output #3

1

Notes/Hints

Constraints

  • $ 1≦N≦10^7 $

Partial Points

  • If you correctly solve the dataset where $ 1≦N≦1000 $, you will be awarded $ 200 $ points.
  • If you correctly solve the dataset without additional constraints, you will be awarded an additional $ 100 $ points.

Sample Explanation 1

If only the 4th problem is solved, exactly $ 4 $ points are obtained. However, solving the 1st and 3rd problems results in a smaller maximum score.

Sample Explanation 2

The set $\{3,4\}$ is also possible.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4
样例输出
1 3