来源:codeforces:https://codeforces.com/contest/7/problem/A
Kalevitch and Chess
A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch decided to put an end to this tradition and to introduce a new attitude to chessboards.
As before, the chessboard is a square-checkered board with the squares arranged in a 8?×?8 grid, each square is painted black or white. Kalevitch suggests that chessboards should be painted in the following manner: there should be chosen a horizontal or a vertical line of 8 squares (i.e. a row or a column), and painted black. Initially the whole chessboard is white, and it can be painted in the above described way one or more times. It is allowed to paint a square many times, but after the first time it does not change its colour any more and remains black. Kalevitch paints chessboards neatly, and it is impossible to judge by an individual square if it was painted with a vertical or a horizontal stroke.
Kalevitch hopes that such chessboards will gain popularity, and he will be commissioned to paint chessboards, which will help him ensure a comfortable old age. The clients will inform him what chessboard they want to have, and the painter will paint a white chessboard meeting the client's requirements.
It goes without saying that in such business one should economize on everything — for each commission he wants to know the minimum amount of strokes that he has to paint to fulfill the client's needs. You are asked to help Kalevitch with this task.
Input
The input file contains 8 lines, each of the lines contains 8 characters. The given matrix describes the client's requirements, W character stands for a white square, and B character — for a square painted black.
It is guaranteed that client's requirments can be fulfilled with a sequence of allowed strokes (vertical/column or horizontal/row).
Output
Output the only number — the minimum amount of rows and columns that Kalevitch has to paint on the white chessboard to meet the client's requirements.
Examples
input
WWWBWWBW BBBBBBBB WWWBWWBW WWWBWWBW WWWBWWBW WWWBWWBW WWWBWWBW WWWBWWBW
output
3
input
WWWWWWWW BBBBBBBB WWWWWWWW WWWWWWWW WWWWWWWW WWWWWWWW WWWWWWWW WWWWWWWW
output
1
翻译:波兰著名画家Kalevitch热于震惊世人,他最后痴迷事物之一就是棋。一千年来,人们一直在单调,无趣的棋盘上玩着这个古老的游戏,Kalevitch决定结束这个传统,并引进新的对于棋盘的态度。
和以前一样,棋盘是带有8*8正方形方格的方形棋盘。每一个正方形都涂成黑色或者白色。Kalevitch建议棋盘应该按照一下方式进行绘制:应该选择一条8方格的水平线或者垂直线(即一行或者一列),并且涂成黑色。最初整个棋盘是白色的,可以按照上面描述方式进行一次或多次的涂。允许可以涂一个方格多次,但是在第一次之后方格不在改变其颜色并保持黑色。,Kalevitch整齐的绘制棋盘,但是他不可能通过单个方格判断由水平线还是垂直线绘制的。
Kalevitch希望这个棋盘可以获得人们的欢迎,他讲受委托去绘制这个棋盘,这将确保他有一个舒适的晚年。客户将会告诉他,他们想要一个什么样的棋盘,并且这个画家将会根据客户的要求绘制白色棋盘。
不用说,在这样一个业务中,人们应该节省一切,对于每个佣金,他想知道满足客户需求的最少笔画量。你被要求去完成这个任务。
输入:
输入包含8行,每一行包含8个字符,给定的矩阵描述了客户的需求,W字符代表一个白色正方形,B字符代表将方格涂成黑色。
保证满足客户的需求通过一系列的笔画(垂直线/列,水平线/行)。
输出:
输出只有一个整数,Kalevitch不得不满足客户需求画白色棋盘所需要的最少行列数。
总结:这篇文章有点难,有一些单词看不懂,大概意思也没有理解,但是根据所给出的例题大概能退出是什么意思,明天再坚持!!!!
obsessions | 英 [?b?s???nz] | 美 [?b?s???nz] |
n. | 痴迷; 着魔; 困扰; 使人痴迷的人(或物); |
monotonous | |
英 [m??n?t?n?s] | 美 [m??nɑ?t?n?s] |
adj. | 单调的; 单调乏味的; |
horizontal | |
英 [?h?r??z?ntl] | 美 [?h??r??zɑ?ntl] |
adj. | 水平的; 与地面平行的; 横的; |
n. | 水平位置; 水平线; 水平面; 横线; 横切面; |
vertical | 英 [?v??t?kl] | 美 [?v??rt?kl] |
adj. | 竖的; 垂直的; 直立的; 纵向的; |
n. | 垂直线; 垂直位置; |
neatly | 英 [ni:tl?] | 美 [?nitl?] |
adv. | 整齐地; 整洁地;干净地; 灵巧地;利索地; 恰好地;极好地; |
commission | 英 [k??m??n] | 美 [k??m??n] |
n. | (通常为政府管控或调查某事的)委员会; 佣金; 回扣; (银行等的)手续费; 正式委托; 军官职务; 做出(错事); |
vt. | 正式委托(谱写或制作、创作、完成); 任命…为军官; |