@@ -18,59 +18,58 @@ tags:
18
18
19
19
<!-- description:start -->
20
20
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 >
22
22
23
- <p >车按国际象棋中的规则移动。东,西,南,北四个基本方向任选其一,然后一直向选定的方向移动,直到满足下列四个条件之一: </p >
23
+ <p >车可以按水平或竖直方向(上,下,左,右)移动任意个方格直到它遇到另一个棋子或棋盘的边界。如果它能够在一次移动中移动到棋子的方格,则能够 < strong >吃掉</ strong > 棋子。 </p >
24
24
25
- <ul >
26
- <li>棋手选择主动停下来。</li>
27
- <li>棋子因到达棋盘的边缘而停下。</li>
28
- <li>棋子移动到某一方格来捕获位于该方格上敌方(黑色)的卒,停在该方格内。</li>
29
- <li>车不能进入/越过已经放有其他友方棋子(白色的象)的方格,停在友方棋子前。</li>
30
- </ul >
25
+ <p >注意:车不能穿过其它棋子,比如象和卒。这意味着如果有其它棋子挡住了路径,车就不能够吃掉棋子。</p >
31
26
32
- <p >你现在可以控制车移动一次,请你统计有多少敌方的卒处于你的捕获范围内(即,可以被一步捕获的棋子数) 。</p >
27
+ <p >返回白车将能 < strong >吃掉</ strong > 的 < strong >卒的数量</ strong > 。</p >
33
28
34
29
<p >  ; </p >
35
30
36
31
<p ><strong >示例 1:</strong ></p >
37
32
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 >
39
34
40
- <pre ><strong >输入:</strong >[[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; R" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; p" ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ],[" ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ," ; ." ; ]]
35
+ <pre >
36
+ <strong >输入:</strong >[[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","R",".",".",".","p"],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
41
37
<strong >输出:</strong >3
42
38
<strong >解释:
43
- </strong >在本例中,车能够捕获所有的卒 。
39
+ </strong >在本例中,车能够吃掉所有的卒 。
44
40
</pre >
45
41
46
42
<p ><strong >示例 2:</strong ></p >
47
43
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 >
49
45
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",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
51
48
<strong >输出:</strong >0
52
49
<strong >解释:
53
- </strong >象阻止了车捕获任何卒 。
50
+ </strong >象阻止了车吃掉任何卒 。
54
51
</pre >
55
52
56
53
<p ><strong >示例 3:</strong ></p >
57
54
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 >
59
56
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",".",".",".","."],[".",".",".",".",".",".",".","."]]
61
59
<strong >输出:</strong >3
62
60
<strong >解释: </strong >
63
- 车可以捕获位置 b5,d6 和 f5 的卒。
61
+ 车可以吃掉位置 b5,d6 和 f5 的卒。
64
62
</pre >
65
63
66
64
<p >  ; </p >
67
65
68
66
<p ><strong >提示:</strong ></p >
69
67
70
68
<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>
74
73
</ol >
75
74
76
75
<!-- description:end -->
0 commit comments