1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 11:21:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part3

This commit is contained in:
2022-03-27 20:46:41 +08:00
parent 6dafca13c5
commit dfacb20d31
1385 changed files with 115239 additions and 3 deletions

View File

@@ -0,0 +1,37 @@
<p>最初记事本上只有一个字符 <code>'A'</code> 。你每次可以对这个记事本进行两种操作:</p>
<ul>
<li><code>Copy All</code>(复制全部):复制这个记事本中的所有字符(不允许仅复制部分字符)。</li>
<li><code>Paste</code>(粘贴):粘贴<strong> 上一次 </strong>复制的字符。</li>
</ul>
<p>给你一个数字&nbsp;<code>n</code> ,你需要使用最少的操作次数,在记事本上输出 <strong>恰好</strong>&nbsp;<code>n</code>&nbsp;<code>'A'</code> 。返回能够打印出&nbsp;<code>n</code>&nbsp;<code>'A'</code> 的最少操作次数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>3
<strong>输出:</strong>3
<strong>解释:</strong>
最初, 只有一个字符 'A'。
第 1 步, 使用 <strong>Copy All</strong> 操作。
第 2 步, 使用 <strong>Paste </strong>操作来获得 'AA'。
第 3 步, 使用 <strong>Paste</strong> 操作来获得 'AAA'。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 1
<strong>输出:</strong>0
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 1000</code></li>
</ul>