ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

2.7题目翻译

2022-02-07 21:03:10  阅读:269  来源: 互联网

标签:翻译 题目 number chessmen 棋子 black white 黑棋子 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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有