F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Move Move Look

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1363    Accepted Submission(s): 844


Problem Description
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.
 

Input
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).
 

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

Sample Input
3
 

Sample Output
3
 

Author
SmallBeer(CML)
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-17 02:26:18, Gzip enabled