题库练习 Jumps
← 上一题 下一题 →

A13883 | Jumps

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are standing on the $\mathit{OX}$ -axis at point $0$ and you want to move to an integer point $x > 0$ .

You can make several jumps. Suppose you're currently at point $y$ ( $y$ may be negative) and jump for the $k$ -th time. You can:

- either jump to the point $y + k$
- or jump to the point $y - 1$ .

What is the minimum number of jumps you need to reach the point $x$ ?

输入格式

The first line contains a single integer $t$ ( $1 \le t \le 1000$ ) — the number of test cases.

The first and only line of each test case contains the single integer $x$ ( $1 \le x \le 10^6$ ) — the destination point.

输出格式

For each test case, print the single integer — the minimum number of jumps to reach $x$ . It can be proved that we can reach any integer point $x$ .

输入输出样例

输入 #1
5
1
2
3
4
5
输出 #1
1
3
2
3
4
C++ 编辑器
输入
输出