CF1455B-Jumps
目录
CF1455B-Jumps
题目:
题目描述:
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:
|
|
样例输出1:
|
|
思路:
实现:
|
|