跳棋的跳转策略问题,用C语言实现跳棋跳转怎么实现?

Problem Description
Little X, Little Y and Little Z are playing checkers when Little Y is annoyed. So he wants to make the chessboard much bigger. Although Little Z insists the original version, Little X stands by Little Y. After they enlarge the chessboard, the chessboard turns to an infinite line.
The chessboard is like the Number Axes now, with each integer point able to hold a checker. At initial status there are three checkers on three different integer points , and through the game there always are three checkers. Every time, they can choose a checker A to jump across a pivot checker B to a new position(but the distance between old A and B equals to new A and B, and there should be no other checkers except B in the range [old A, new A]).
After playing for a while, they wonder whether an given status a,b,c can be transferred to x,y,z. obeying the rules. Since the checkers are considered the same, it is unnecessary for a must jump to x.

Input
The first line is a,b,c.
The second line is x,y,z.
They are all integers in range (-10^9, 10^9) and the two status are valid.

Output
The first line is YES or NO, showing whether the transfer can be achieved.
If it is YES, then output the least steps in the second line.

Sample Input
1 2 3
0 3 5

Sample Output
YES
2

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

0
跳棋的跳转策略问题,用C语言实现跳棋跳转怎么实现?
0
Pyramid Split,请问这个算法用C语言实现一般的思路是什么?
0
C语言解决:日和判断是否满足条件得到doubixp
0
空间四面体的分割计算的问题,用C语言怎么才能实现呢?
3
一个有关如何合并字符串的问题,算法请教怎么实现的思路?
0
求问一个比较典型的算法问题,要求计算每个商品的价格,怎么写?
0
这个问题,长度一大,计算就很慢,有什么办法可以优化程序算法?
1
这是一个有关魔方的问题,请问怎么计算旋转的步数
0
请问大家这个问题用C语言怎么才能实现运行呢?总是超时间
1
一个有关于:逻辑推理方面的算法,用C语言解决,谢谢了
2
输出结果精确6位小数,这个用C语言怎么实现呢?
0
组合数的排列算法问题,请问这里的序列怎么得到,用C语言。。。
1
求问这个问题里输出inf用C语言是怎么实现的?不是很清楚,求解释。
0
带错误检查的表达式计算器用C语言怎么实现的呢?
0
这个问题的C语言的算法是怎么实现的?没有一点思路
0
用C语言实现多边形顶点计算的一个问题,具体看下面
0
遇到一个比较模糊的问题,这个问题用二判定怎么实现呢?
1
这个算法问题,请大身看下怎么解决,如何输出公因数
0
这个算法问题如果要用递归来做,应该怎么做呢?
1
判断一个序列是不是等比级数。用C语言解答这个问题怎么做呢?