mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
update
This commit is contained in:
27
leetcode-cn/problem (Chinese)/设计机械累加器 [qiu-12n-lcof].html
Normal file
27
leetcode-cn/problem (Chinese)/设计机械累加器 [qiu-12n-lcof].html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>请设计一个机械累加器,计算从 1、2... 一直累加到目标数值 <code>target</code> 的总和。注意这是一个只能进行加法操作的程序,不具备乘除、if-else、switch-case、for 循环、while 循环,及条件判断语句等高级功能。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> target = 5
|
||||
<strong>输出: </strong>15
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> target = 7
|
||||
<strong>输出: </strong>28
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= target <= 10000</code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
Reference in New Issue
Block a user