@@ -18,59 +18,58 @@ tags:
1818
1919<!-- description:start -->
2020
21- <p >在一个 8 x 8 的棋盘上,有一个白色的车(< code >Rook</ code >) ,用字符 <code >&# 39 ; R &# 39 ; </code > 表示。棋盘上还可能存在空方块,白色的象( <code >Bishop </code >)以及黑色的卒(< code >pawn</ code >),分别用字符 < code > &# 39 ; . &# 39 ; </ code >,< code > &# 39 ; B &# 39 ; < /code > 和 <code >&# 39 ; p &# 39 ; </code > 表示。不难看出,大写字符表示的是白棋,小写字符表示的是黑棋 。</p >
21+ <p >给定一个 & nbsp ; < code > 8 x 8</ code > 的棋盘,< strong >只有一个</ strong > 白色的车 ,用字符 <code >'R' </code > 表示。棋盘上还可能存在白色的象 & nbsp ; <code >'B' </code >& nbsp ; 以及黑色的卒 & nbsp ; < code >'p'< /code >。空方块用字符 <code >'.' </code >& nbsp ; 表示 。</p >
2222
23- <p >车按国际象棋中的规则移动。东,西,南,北四个基本方向任选其一,然后一直向选定的方向移动,直到满足下列四个条件之一: </p >
23+ <p >车可以按水平或竖直方向(上,下,左,右)移动任意个方格直到它遇到另一个棋子或棋盘的边界。如果它能够在一次移动中移动到棋子的方格,则能够 < strong >吃掉</ strong > 棋子。 </p >
2424
25- <ul >
26- <li>棋手选择主动停下来。</li>
27- <li>棋子因到达棋盘的边缘而停下。</li>
28- <li>棋子移动到某一方格来捕获位于该方格上敌方(黑色)的卒,停在该方格内。</li>
29- <li>车不能进入/越过已经放有其他友方棋子(白色的象)的方格,停在友方棋子前。</li>
30- </ul >
25+ <p >注意:车不能穿过其它棋子,比如象和卒。这意味着如果有其它棋子挡住了路径,车就不能够吃掉棋子。</p >
3126
32- <p >你现在可以控制车移动一次,请你统计有多少敌方的卒处于你的捕获范围内(即,可以被一步捕获的棋子数) 。</p >
27+ <p >返回白车将能 < strong >吃掉</ strong > 的 < strong >卒的数量</ strong > 。</p >
3328
3429<p >  ; </p >
3530
3631<p ><strong >示例 1:</strong ></p >
3732
38- <p ><img alt =" " src =" https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_1_improved.png " style =" height : 305px ; width : 300px ;" ></p >
33+ <p ><img alt =" " src =" https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_1_improved.png " style =" height : 305px ; width : 300px ;" / ></p >
3934
40- <pre ><strong >输入:</strong >[[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; R" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ]]
35+ <pre >
36+ <strong >输入:</strong >[[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","R",".",".",".","p"],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
4137<strong >输出:</strong >3
4238<strong >解释:
43- </strong >在本例中,车能够捕获所有的卒 。
39+ </strong >在本例中,车能够吃掉所有的卒 。
4440</pre >
4541
4642<p ><strong >示例 2:</strong ></p >
4743
48- <p ><img alt =" " src =" https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_2_improved.png " style =" height : 306px ; width : 300px ;" ></p >
44+ <p ><img alt =" " src =" https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_2_improved.png " style =" height : 306px ; width : 300px ;" / ></p >
4945
50- <pre ><strong >输入:</strong >[[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; p" ; ," ; p" ; ," ; p" ; ," ; p" ; ," ; p" ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; p" ; ," ; p" ; ," ; B" ; ," ; p" ; ," ; p" ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; p" ; ," ; B" ; ," ; R" ; ," ; B" ; ," ; p" ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; p" ; ," ; p" ; ," ; B" ; ," ; p" ; ," ; p" ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; p" ; ," ; p" ; ," ; p" ; ," ; p" ; ," ; p" ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ]]
46+ <pre >
47+ <strong >输入:</strong >[[".",".",".",".",".",".",".","."],[".","p","p","p","p","p",".","."],[".","p","p","B","p","p",".","."],[".","p","B","R","B","p",".","."],[".","p","p","B","p","p",".","."],[".","p","p","p","p","p",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
5148<strong >输出:</strong >0
5249<strong >解释:
53- </strong >象阻止了车捕获任何卒 。
50+ </strong >象阻止了车吃掉任何卒 。
5451</pre >
5552
5653<p ><strong >示例 3:</strong ></p >
5754
58- <p ><img alt =" " src =" https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_3_improved.png " style =" height : 305px ; width : 300px ;" ></p >
55+ <p ><img alt =" " src =" https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_3_improved.png " style =" height : 305px ; width : 300px ;" / ></p >
5956
60- <pre ><strong >输入:</strong >[[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; p" ; ," ; p" ; ," ; ." ; ," ; R" ; ," ; ." ; ," ; p" ; ," ; B" ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; B" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ]]
57+ <pre >
58+ <strong >输入:</strong >[[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","p",".",".",".","."],["p","p",".","R",".","p","B","."],[".",".",".",".",".",".",".","."],[".",".",".","B",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."]]
6159<strong >输出:</strong >3
6260<strong >解释: </strong >
63- 车可以捕获位置 b5,d6 和 f5 的卒。
61+ 车可以吃掉位置 b5,d6 和 f5 的卒。
6462</pre >
6563
6664<p >  ; </p >
6765
6866<p ><strong >提示:</strong ></p >
6967
7068<ol >
71- <li><code>board.length == board[i].length == 8</code></li>
72- <li><code>board[i][j]</code> 可以是 <code>'R'</code>,<code>'.'</code>,<code>'B'</code> 或 <code>'p'</code></li>
73- <li>只有一个格子上存在 <code>board[i][j] == 'R'</code></li>
69+ <li><code>board.length == 8</code></li>
70+ <li><code>board[i].length == 8</code></li>
71+ <li><code>board[i][j]</code> 可以是 <code>'R'</code>,<code>'.'</code>,<code>'B'</code> 或 <code>'p'</code></li>
72+ <li>只有一个格子上存在 <code>board[i][j] == 'R'</code></li>
7473</ol >
7574
7675<!-- description:end -->
0 commit comments