其他分享
首页 > 其他分享> > 2.7题目翻译

2.7题目翻译

作者:互联网

题目链接:https://acs.jxnu.edu.cn/problem/HDU1295

There are two color (white and black) chessmen in a row. The number of white chessman is equal to the number of black chessman. The left half of the row is black chessmen and the right half of the row is white chessmen at first. There are two rules for the game. 
1.  Only two neighbor chessmen (double black, double white or one black and one white) can be moved to vacancy at one time. The new vacancy can be filled by the two new neighbor chessmen. Repeat moving chessmen until all chessmen are interphase with black chessman and white chessman.
2.  The number of move must be the minimum.

The case n=3 is shown in Fig. 1. Your task is to get the number of the minimum steps.

输入:

There are multiple cases in this problem and ended by the EOF. In each case, there is only one integer means the number of black chessmen (the same as white chessmen) n(3<=n<=1000).

输出:

For each test case, there is only one integer means the minimum steps.

棋子在一排中有两种颜色(白色和黑色)。白棋子的数等于黑棋子的数。一开始这排的左半部分是黑棋子,右半部分是白色的棋子。这个游戏有两个规则。 1.一次只有两个相邻的棋子(双黑、双白或一个黑和一个白)可以移动到空缺。新的空缺可以由两个相邻的棋子填满。重复移动棋子,直到所有棋子与黑棋子和白棋子互换。 2.移动的次数必须是最小的次数。本案 n=3如图1所示。你的任务是获得最少步数。

输入:

在这个问题中有多个情况,并以EOF结束。在每种情况下,只有一个整数表示黑棋子数(与白棋子相同)n(3<=n<=1000)。

输出:

对于每个测试用例,只有一个整数表示最小步数。

标签:翻译,题目,number,chessmen,棋子,black,white,黑棋子,2.7
来源: https://blog.csdn.net/weixin_61393233/article/details/122814543