|
1 |
| -# [2950. Number of Divisible Substrings](https://leetcode.cn/problems/number-of-divisible-substrings) |
| 1 | +# [2950. 可整除子串的数量](https://leetcode.cn/problems/number-of-divisible-substrings) |
2 | 2 |
|
3 | 3 | [English Version](/solution/2900-2999/2950.Number%20of%20Divisible%20Substrings/README_EN.md)
|
4 | 4 |
|
5 | 5 | ## 题目描述
|
6 | 6 |
|
7 | 7 | <!-- 这里写题目描述 -->
|
8 | 8 |
|
9 |
| -<p>Each character of the English alphabet has been mapped to a digit as shown below.</p> |
| 9 | +<p>每个英文字母都被映射到一个数字,如下所示。</p> |
10 | 10 |
|
11 | 11 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2900-2999/2950.Number%20of%20Divisible%20Substrings/images/old_phone_digits.png" style="padding: 10px; width: 200px; height: 200px;" /></p>
|
12 | 12 |
|
13 |
| -<p>A string is <strong>divisible</strong> if the sum of the mapped values of its characters is divisible by its length.</p> |
| 13 | +<p>如果字符串的字符的映射值的总和可以被字符串的长度整除,则该字符串是 <strong>可整除</strong> 的。</p> |
14 | 14 |
|
15 |
| -<p>Given a string <code>s</code>, return <em>the number of <strong>divisible substrings</strong> of</em> <code>s</code>.</p> |
| 15 | +<p>给定一个字符串 <code>s</code>,请返回 <code>s</code> 的<em> <strong>可整除子串</strong> 的数量</em>。</p> |
16 | 16 |
|
17 |
| -<p>A <strong>substring</strong> is a contiguous non-empty sequence of characters within a string.</p> |
| 17 | +<p><strong>子串</strong> 是字符串内的一个连续的非空字符序列。</p> |
18 | 18 |
|
19 | 19 | <p> </p>
|
20 |
| -<p><strong class="example">Example 1:</strong></p> |
| 20 | + |
| 21 | +<p><strong class="example">示例 1:</strong></p> |
21 | 22 |
|
22 | 23 | <table border="1" cellspacing="3" style="border-collapse: separate; text-align: center;">
|
23 | 24 | <tbody>
|
|
102 | 103 | </table>
|
103 | 104 |
|
104 | 105 | <pre>
|
105 |
| -<strong>Input:</strong> word = "asdf" |
106 |
| -<strong>Output:</strong> 6 |
107 |
| -<strong>Explanation:</strong> The table above contains the details about every substring of word, and we can see that 6 of them are divisible. |
| 106 | +<b>输入:</b>word = "asdf" |
| 107 | +<b>输出:</b>6 |
| 108 | +<b>解释:</b>上表包含了有关 word 中每个子串的详细信息,我们可以看到其中有 6 个是可整除的。 |
108 | 109 | </pre>
|
109 | 110 |
|
110 |
| -<p><strong class="example">Example 2:</strong></p> |
| 111 | +<p><b>示例 2:</b></p> |
111 | 112 |
|
112 | 113 | <pre>
|
113 |
| -<strong>Input:</strong> word = "bdh" |
114 |
| -<strong>Output:</strong> 4 |
115 |
| -<strong>Explanation:</strong> The 4 divisible substrings are: "b", "d", "h", "bdh". |
116 |
| -It can be shown that there are no other substrings of word that are divisible. |
| 114 | +<b>输入:</b>word = "bdh" |
| 115 | +<b>输出:</b>4 |
| 116 | +<b>解释:</b>4 个可整除的子串是:"b","d","h","bdh"。 |
| 117 | +可以证明 word 中没有其他可整除的子串。 |
117 | 118 | </pre>
|
118 | 119 |
|
119 |
| -<p><strong class="example">Example 3:</strong></p> |
| 120 | +<p><b>示例 3:</b></p> |
120 | 121 |
|
121 | 122 | <pre>
|
122 |
| -<strong>Input:</strong> word = "abcd" |
123 |
| -<strong>Output:</strong> 6 |
124 |
| -<strong>Explanation:</strong> The 6 divisible substrings are: "a", "b", "c", "d", "ab", "cd". |
125 |
| -It can be shown that there are no other substrings of word that are divisible. |
| 123 | +<b>输入:</b>word = "abcd" |
| 124 | +<b>输出:</b>6 |
| 125 | +<b>解释:</b>6 个可整除的子串是:"a","b","c","d","ab","cd"。 |
| 126 | +可以证明 word 中没有其他可整除的子串。 |
126 | 127 | </pre>
|
127 | 128 |
|
128 | 129 | <p> </p>
|
129 |
| -<p><strong>Constraints:</strong></p> |
| 130 | + |
| 131 | +<p><b>提示:</b></p> |
130 | 132 |
|
131 | 133 | <ul>
|
132 | 134 | <li><code>1 <= word.length <= 2000</code></li>
|
133 |
| - <li><code>word</code> consists only of lowercase English letters.</li> |
| 135 | + <li><code>word</code> 仅包含小写英文字母。</li> |
134 | 136 | </ul>
|
135 | 137 |
|
136 | 138 | ## 解法
|
|
0 commit comments