hdoj.1295 Move Move Look【水题】 2015/08/06
2015-08-06 10:56
405 查看
Move Move Look
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 853 Accepted Submission(s): 542
[align=left]Problem Description[/align]
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.
[align=left]Input[/align]
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).
[align=left]Output[/align]
For each test case, there is only one integer means the minimum steps.
[align=left]Sample Input[/align]
3
[align=left]Sample Output[/align]
3
[align=left]Author[/align]
SmallBeer(CML)
[align=left]Source[/align]
杭电ACM集训队训练赛(VIII)
n = 4 时:
0 0 0 0 1 1 1 1
0 0 1 1 1 1 0 0
0 1 1 0 1 1 0 0
0 1 1 0 1 0 1 0
1 0 1 0 1 0 1 0
#include<iostream> #include<cstdio> using namespace std; int main(){ int n; while( ~scanf("%d",&n) ){ printf("%d\n",n); } return 0; }
相关文章推荐
- HDU 2701 Lampyridae Teleportae
- 16. Element contentEditable 属性
- 该登录名来自不受信任的域,不能与 Windows 身份验证一起使用。
- AD管理-兰晓宇-专题视频课程
- 【Cocos2d入门教程三】HelloWorld之一目了然
- ulimit -a详解
- hive DATEDIFF NULL
- sql触发器(insert,update,delete)
- Web.xml配置详解之context-param
- HDU 4323
- Basic vi Commands
- Elasticsarch及插件安装
- 对于Unicode编码在js中和html中
- cakePHP 分页栏
- Android:WebView(慕课网)
- redis 内存库设置 教你怎么解决64位Windows版Redis狂占C盘的问题.
- 迁移至个人blog
- Win10正式版死机运行程序无响应该怎么办?
- 为zabbix增加服务器信息统计(服务器品牌、型号、SN号等)
- Asynctask解析以及注意事项