This topic to do
The subject background
Taoyuan forest of an area is suf-fering, Monkey King is going to the monkey of part of the organization a food supply chain.
Title description
Taoyuan forest of an area is suf-fering, Monkey King is going to the monkey of part of the organization a food supply chain.
10 x 1010 x 10
.
.
.
. B...
.
. R...
.
.
. L...
.
Forest is divided into the space of a 10 * 10 characters' B 'said dish famine areas, characters' L,' said the area of food is enough, can provide food, and the characters' R 'forest of this area is a pond, the food chain, of course, not from the pond, the monkey want to food shortages and food rich in an area between a "food delivery queue", so they can pass along this path of food to help the famine areas, requirements: 1, the food can only pass along the direction of the up and down or so four 2, each grid can only need to arrange a monkey for food transport tasks, sufficient famine area and food area does not need additional arrangement monkeys, 3, the monkey hate water, all no monkey likes in the pond transmission food, 4, to ensure food shortages and food area is not rich, please help the monkey to calculate in order to form such a "food delivery queue" at least need how many monkeys,
Input format
Input contains 10 lines, each line 10 characters, describes the layout of the forest, the input to ensure design 'B', just have a characters in a character 'L' and a 'R' characters,
The output format
Output an integer, to form a viable food the minimum quantity needed to transmit queue monkeys,
Input and output sample
Enter the # 1 copy
.
.
.
. B...
.
. R...
.
.
. L...
.
Output # 1 copy
7
Instructions/tip
In this case, the following is a feasible scheme, using the minimum number of monkeys (7) :
.
.
.
. B...
. C...
. CC. R...
. CCC...
. C...
. L...
.
CodePudding user response:
to helpCodePudding user response:
Help!