300046: CF11B. Jumping Jack

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Jumping Jack

题意翻译

## 题目简述 从原点开始移动,目标为点 $x$ 。第 $n$ 次移动 $n$ 个单位。每次皆可以向左、右两个方向跳跃,求到达 $x$ 所需要的最少移动次数。 输入仅一行,一个整数 $x$ $(-10^9\leq x\leq 10^9)$ 。 输出到达 $x$ 所需要的最少移动次数。 @Aw顿顿 感谢您提供的翻译

题目描述

Jack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point $ x $ . In order to train, he has decided that he'll first jump by only one unit, and each subsequent jump will be exactly one longer than the previous one. He can go either left or right with each jump. He wonders how many jumps he needs to reach $ x $ .

输入输出格式

输入格式


The input data consists of only one integer $ x $ ( $ -10^{9}<=x<=10^{9} $ ).

输出格式


Output the minimal number of jumps that Jack requires to reach $ x $ .

输入输出样例

输入样例 #1

2

输出样例 #1

3

输入样例 #2

6

输出样例 #2

3

输入样例 #3

0

输出样例 #3

0

Input

题意翻译

## 题目简述 从原点开始移动,目标为点 $x$ 。第 $n$ 次移动 $n$ 个单位。每次皆可以向左、右两个方向跳跃,求到达 $x$ 所需要的最少移动次数。 输入仅一行,一个整数 $x$ $(-10^9\leq x\leq 10^9)$ 。 输出到达 $x$ 所需要的最少移动次数。 @Aw顿顿 感谢您提供的翻译

加入题单

上一题 下一题 算法标签: