# UVa 10422:knights in FEN

Source: Internet
Author: User
Tags empty

Topic Link:

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=110&page=show_ problem&problem=1363

Type of topic: implicit graph Search

Original title:

There are black and white knights on a 5 by 5 chessboard. There are twelve of each color, and There are one square, is empty. At any time, a knight can move to an empty square as long as it moves like a knight in normal chess (what else did you E Xpect?).

Given an initial position of the board, the question Is:what are the minimum number of moves in which we can reach the fin Al position which is:

Input

The "I" of the input file contains an integer N (n<14) that indicates how many sets of inputs are. The description of each set is given below:

Each set consists of five lines; Each line represents one row of a chessboard. The positions occupied by White Knights are marked by 0 and the positions occupied from Black Knights are marked by 1. The space corresponds to the empty square on board.

There is no blank line between the two sets of input.

The ' the ' sample input below corresponds to this configuration:

Output

For each set your task are to find the minimum number of moves leading from the starting input configuration to the final O Ne. If is bigger than then output one line stating

`Unsolvable in less than one move (s).`

Otherwise output one line stating

Solvable in N-Move (s).

where n <= 10.

The output for each set was produced in a single line as shown in the sample output.

Sample Input

`2`
`01011`
`110 1`
`01110`
`01010`
`00100`
`10110`
`01 11`
`10111`
`01001`
`00000`

Sample Output

`Unsolvable in less than one move (s).`
`Solvable in 7 move (s).`

Related Keywords:

### Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.