Skip to content

Commit 3a563a2

Browse files
committed
fix: console table text length verflow dislocation error
1 parent 1eccefb commit 3a563a2

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

common/utils/question-handler/showLogs.js

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export function showLogs(fnName, paramMap, compareMap) {
7171
]
7272
})
7373
logsItems.forEach((item) => {
74+
for(let key in item) {
75+
if(key === '预期结果' || key === '执行结果') {
76+
item[key] = item[key].length >= 40 ? `${item[key].slice(0, 37)}...` : item[key]
77+
}
78+
}
7479
logTable.addRow(item, { color: item.测试结果 === '通过' ? 'green' : 'red', })
7580
})
7681
logTable.printTable();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<p>给你一个下标从 <strong>0</strong> 开始的字符串 <code>word</code> ,长度为 <code>n</code> ,由从 <code>0</code> 到 <code>9</code> 的数字组成。另给你一个正整数 <code>m</code> 。</p>
2+
3+
<p><code>word</code> 的 <strong>可整除数组</strong> <code>div</code>&nbsp; 是一个长度为 <code>n</code> 的整数数组,并满足:</p>
4+
5+
<ul>
6+
<li>如果 <code>word[0,...,i]</code> 所表示的 <strong>数值</strong> 能被 <code>m</code> 整除,<code>div[i] = 1</code></li>
7+
<li>否则,<code>div[i] = 0</code></li>
8+
</ul>
9+
10+
<p>返回<em> </em><code>word</code> 的可整除数组。</p>
11+
12+
<p>&nbsp;</p>
13+
14+
<p><strong>示例 1:</strong></p>
15+
16+
<pre>
17+
<strong>输入:</strong>word = "998244353", m = 3
18+
<strong>输出:</strong>[1,1,0,0,0,1,1,0,0]
19+
<strong>解释:</strong>仅有 4 个前缀可以被 3 整除:"9"、"99"、"998244" 和 "9982443" 。
20+
</pre>
21+
22+
<p><strong>示例 2:</strong></p>
23+
24+
<pre>
25+
<strong>输入:</strong>word = "1010", m = 10
26+
<strong>输出:</strong>[0,1,0,1]
27+
<strong>解释:</strong>仅有 2 个前缀可以被 10 整除:"10" 和 "1010" 。
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
32+
<p><strong>提示:</strong></p>
33+
34+
<ul>
35+
<li><code>1 &lt;= n &lt;= 10<sup>5</sup></code></li>
36+
<li><code>word.length == n</code></li>
37+
<li><code>word</code> 由数字 <code>0</code> 到 <code>9</code> 组成</li>
38+
<li><code>1 &lt;= m &lt;= 10<sup>9</sup></code></li>
39+
</ul>

src/2575.find-the-divisibility-array-of-a-string/question.js

+55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)