1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/机器人的运动范围 [ji-qi-ren-de-yun-dong-fan-wei-lcof].html
2022-03-29 12:43:11 +08:00

23 lines
919 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>地上有一个m行n列的方格从坐标 <code>[0,0]</code> 到坐标 <code>[m-1,n-1]</code> 。一个机器人从坐标 <code>[0, 0] </code>的格子开始移动它每次可以向左、右、上、下移动一格不能移动到方格外也不能进入行坐标和列坐标的数位之和大于k的格子。例如当k为18时机器人能够进入方格 [35, 37] 因为3+5+3+7=18。但它不能进入方格 [35, 38]因为3+5+3+8=19。请问该机器人能够到达多少个格子</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>m = 2, n = 3, k = 1
<strong>输出:</strong>3
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>m = 3, n = 1, k = 0
<strong>输出:</strong>1
</pre>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n,m &lt;= 100</code></li>
<li><code>0 &lt;= k&nbsp;&lt;= 20</code></li>
</ul>