| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 15018 | Long Live The King |
|
| 15019 | Crazy Little Thing Called Math |
|
Description

The royal castle has been invaded!
The King is surrounded by enemy Rooks and Bishops, and he needs to escape before it is too late. Luckily, the King can still move one square in any of the 8 directions around him, just like in chess.
However, not every square is safe.
Just like in chess, an enemy Rook attacks horizontally and vertically, while an enemy Bishop attacks diagonally. Both pieces continue attacking in a direction until they reach the edge of the board or another piece blocks their path (except the king).
Your task is to determine how many safe squares the King can move to. His current position is not counted.
The board contains:
Kthe kingRan enemy rookBan enemy bishop.an empty square
A safe square is defined as an empty square that is not attacked by the enemy rook or bishop.
(Note: The King cannot attack enemy rook/bishop)
Bishop Move Illustration

Rook Move Illustration

Sample Input #1 Illustration

Input
The input consists of exactly 8 lines, each line contains 8 characters, representing an 8 × 8 chessboard.
It is guaranteed that there will be exactly one K.
The board contains only the characters K, R, B, and .
Output
Output one integer representing the number of safe squares the King can move to
If there is no safe square, output Checkmate!
Sample Input Download
Sample Output Download
Tags
Discuss
Description

A palindrome is a number that reads the same from left to right and from right to left.
For example:
1331
7
are palindromes, while:
101010
123
are not.
You are given a positive integer N.
If N is not a palindrome, reverse its digits and add the reversed number to the original number.
Then repeat the same process with the new number until a palindrome is reached.
For example, starting with 195:
786 + 687 = 1473
1473 + 3741 = 5214
5214 + 4125 = 9339
Since 9339 is a palindrome, the process stops.
Your task is to determine how many additions are needed to reach a palindrome and what the final palindrome is.
If the steps needed are more than 100, print Not found. instead
Input
One positive integer:
N
where:
1 ≤ N ≤ 100000
Output
Print two integers separated by a space:
steps palindrome
where:
steps is the number of reverse-and-add operations performed.
palindrome is the final palindrome reached.
If N is already a palindrome, steps is 0.
If the steps are more than 100, print Not found. instead