1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最大得分的路径数目 [number-of-paths-with-max-score].html
2022-03-29 12:43:11 +08:00

41 lines
1.5 KiB
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>给你一个正方形字符数组&nbsp;<code>board</code>&nbsp;,你从数组最右下方的字符&nbsp;<code>&#39;S&#39;</code>&nbsp;出发。</p>
<p>你的目标是到达数组最左上角的字符&nbsp;<code>&#39;E&#39;</code> ,数组剩余的部分为数字字符&nbsp;<code>1, 2, ..., 9</code>&nbsp;或者障碍 <code>&#39;X&#39;</code>。在每一步移动中,你可以向上、向左或者左上方移动,可以移动的前提是到达的格子没有障碍。</p>
<p>一条路径的 「得分」 定义为:路径上所有数字的和。</p>
<p>请你返回一个列表,包含两个整数:第一个整数是 「得分」 的最大值,第二个整数是得到最大得分的方案数,请把结果对&nbsp;<strong><code>10^9 + 7</code></strong> <strong>取余</strong></p>
<p>如果没有任何路径可以到达终点,请返回&nbsp;<code>[0, 0]</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>board = [&quot;E23&quot;,&quot;2X2&quot;,&quot;12S&quot;]
<strong>输出:</strong>[7,1]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>board = [&quot;E12&quot;,&quot;1X1&quot;,&quot;21S&quot;]
<strong>输出:</strong>[4,2]
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>board = [&quot;E11&quot;,&quot;XXX&quot;,&quot;11S&quot;]
<strong>输出:</strong>[0,0]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= board.length == board[i].length &lt;= 100</code></li>
</ul>