|
1 |
| -# [2533. Number of Good Binary Strings](https://leetcode.cn/problems/number-of-good-binary-strings) |
| 1 | +# [2533. 好二进制字符串的数量](https://leetcode.cn/problems/number-of-good-binary-strings) |
2 | 2 |
|
3 | 3 | [English Version](/solution/2500-2599/2533.Number%20of%20Good%20Binary%20Strings/README_EN.md)
|
4 | 4 |
|
5 | 5 | ## 题目描述
|
6 | 6 |
|
7 | 7 | <!-- 这里写题目描述 -->
|
8 | 8 |
|
9 |
| -<p>You are given four integers <code>minLenght</code>, <code>maxLength</code>, <code>oneGroup</code> and <code>zeroGroup</code>.</p> |
| 9 | +<p><span style="">给你四个整数 </span><code>minLenght</code>、<code>maxLength</code>、<code>oneGroup</code><span style=""> 和 </span><code>zeroGroup</code><span style=""> 。</span></p> |
10 | 10 |
|
11 |
| -<p>A binary string is <strong>good</strong> if it satisfies the following conditions:</p> |
| 11 | +<p><strong>好 </strong>二进制字符串满足下述条件:</p> |
12 | 12 |
|
13 | 13 | <ul>
|
14 |
| - <li>The length of the string is in the range <code>[minLength, maxLength]</code>.</li> |
15 |
| - <li>The size of each block of consecutive <code>1</code>'s is a multiple of <code>oneGroup</code>. |
| 14 | + <li>字符串的长度在 <code>[minLength, maxLength]</code> 之间。</li> |
| 15 | + <li>每块连续 <code>1</code> 的个数是 <code>oneGroup</code> 的整数倍 |
16 | 16 | <ul>
|
17 |
| - <li>For example in a binary string <code>00<u>11</u>0<u>1111</u>00</code> sizes of each block of consecutive ones are <code>[2,4]</code>.</li> |
| 17 | + <li>例如在二进制字符串 <code>00<em><strong>11</strong></em>0<em><strong>1111</strong></em>00</code> 中,每块连续 <code>1</code> 的个数分别是<code>[2,4]</code> 。</li> |
18 | 18 | </ul>
|
19 | 19 | </li>
|
20 |
| - <li>The size of each block of consecutive <code>0</code>'s is a multiple of <code>zeroGroup</code>. |
| 20 | + <li>每块连续 <code>0</code> 的个数是 <code>zeroGroup</code> 的整数倍 |
21 | 21 | <ul>
|
22 |
| - <li>For example, in a binary string <code><u>00</u>11<u>0</u>1111<u>00</u></code> sizes of each block of consecutive ones are <code>[2,1,2]</code>.</li> |
| 22 | + <li>例如在二进制字符串 <code><em><strong>00</strong></em>11<em><strong>0</strong></em>1111<em><strong>00</strong></em></code> 中,每块连续 <code>0</code> 的个数分别是 <code>[2,1,2]</code> 。</li> |
23 | 23 | </ul>
|
24 | 24 | </li>
|
25 | 25 | </ul>
|
26 | 26 |
|
27 |
| -<p>Return <em>the number of <strong>good</strong> binary strings</em>. Since the answer may be too large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p> |
| 27 | +<p>请返回好二进制字符串的个数。答案可能很大<strong>,</strong>请返回对 <code>10<sup>9</sup> + 7</code> 取余后的结果。</p> |
28 | 28 |
|
29 |
| -<p><strong>Note</strong> that <code>0</code> is considered a multiple of all the numbers.</p> |
| 29 | +<p><strong>注意:</strong><code>0</code> 可以被认为是所有数字的倍数。</p> |
30 | 30 |
|
31 | 31 | <p> </p>
|
32 |
| -<p><strong class="example">Example 1:</strong></p> |
| 32 | + |
| 33 | +<p><strong>示例 1:</strong></p> |
33 | 34 |
|
34 | 35 | <pre>
|
35 |
| -<strong>Input:</strong> minLength = 2, maxLength = 3, oneGroup = 1, zeroGroup = 2 |
36 |
| -<strong>Output:</strong> 5 |
37 |
| -<strong>Explanation:</strong> There are 5 good binary strings in this example: "00", "11", "001", "100", and "111". |
38 |
| -It can be proven that there are only 5 good strings satisfying all conditions. |
39 |
| -</pre> |
| 36 | +<strong>输入:</strong>minLength = 2, maxLength = 3, oneGroup = 1, zeroGroup = 2 |
| 37 | +<strong>输出:</strong>5 |
| 38 | +<strong>解释:</strong>在本示例中有 5 个好二进制字符串: "00", "11", "001", "100", 和 "111" 。 |
| 39 | +可以证明只有 5 个好二进制字符串满足所有的条件。</pre> |
40 | 40 |
|
41 |
| -<p><strong class="example">Example 2:</strong></p> |
| 41 | +<p><strong>示例 2:</strong></p> |
42 | 42 |
|
43 | 43 | <pre>
|
44 |
| -<strong>Input:</strong> minLength = 4, maxLength = 4, oneGroup = 4, zeroGroup = 3 |
45 |
| -<strong>Output:</strong> 1 |
46 |
| -<strong>Explanation:</strong> There is only 1 good binary string in this example: "1111". |
47 |
| -It can be proven that there is only 1 good string satisfying all conditions. |
| 44 | +<strong>输入:</strong>minLength = 4, maxLength = 4, oneGroup = 4, zeroGroup = 3 |
| 45 | +<strong>输出:</strong>1 |
| 46 | +<strong>解释:</strong>在本示例中有 1 个好二进制字符串: "1111" 。 |
| 47 | +可以证明只有 1 个好字符串满足所有的条件。 |
48 | 48 | </pre>
|
49 | 49 |
|
50 | 50 | <p> </p>
|
51 |
| -<p><strong>Constraints:</strong></p> |
| 51 | + |
| 52 | +<p><strong>提示:</strong></p> |
52 | 53 |
|
53 | 54 | <ul>
|
54 | 55 | <li><code>1 <= minLength <= maxLength <= 10<sup>5</sup></code></li>
|
|
0 commit comments