|
||||||||||
King's VisitTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 130 Accepted Submission(s): 11 Problem Description In chess, a king can move horizontally, vertically or diagonally to an adjacent cell in each move. You are given an $8\times 8$ board with some obstacles. The starting position of the king is also given. Your task is to calculate the maximum number of cells that the king can visit, such that: 1.The king never moves to an obstacle. 2.Each cell are visited at most once (the starting position has already been visited at the beginning). Input The first line is the number of test cases. For each test case, there are $8$ lines and each line contains $8$ characters, in which the letter 'K' is the starting position, a letter 'O' is an obstacle and a '.' is an empty cell. There is an empty line after each test case. Output For each test case, output a line containing an integer, which is the maximum number of cells that the king can visit. Sample Input
Sample Output
Source | ||||||||||
|