Jumping Jack(翻译)

本文介绍了Codeforces编程竞赛中的一道题目——JumpingJack,内容涉及如何帮助角色Jack通过一系列跳跃到达目标点x,需要找到最小跳跃次数。输入为一个整数x,输出为到达x所需的最少跳跃数。题目旨在考察编程解决问题和动态规划的能力。
摘要由CSDN通过智能技术生成

2022.2.18

题目网址:

https://codeforces.com/contest/11/problem/B

题目:

Jumping Jack

 1000ms  65536K

描述:

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 ( - 109 ≤ x ≤ 109).

输出:

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

翻译:

描述:

杰克最近正在致力于他的跳跃技巧。现在他位于数字为0的一点。他想要到点x。为了到那里,他已经决定他第一次跳跃只是一个单位,并且每个跳跃将比前一个跳跃更长。他只能向左或者向右跳跃。他想知道是需要多少跳跃才能到达点x。

输入:

输入数据包含一个整数x(-109<=x<=109)。

输出:

输出杰克到达x需要的最少的跳跃次数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值