mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
add leetcode problem-cn part2
This commit is contained in:
27
算法题(国内版)/problem (Chinese)/计算器 [calculator-lcci].html
Normal file
27
算法题(国内版)/problem (Chinese)/计算器 [calculator-lcci].html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>给定一个包含正整数、加(+)、减(-)、乘(*)、除(/)的算数表达式(括号除外),计算其结果。</p>
|
||||
|
||||
<p>表达式仅包含非负整数,<code>+</code>, <code>-</code> ,<code>*</code>,<code>/</code> 四种运算符和空格 <code> </code>。 整数除法仅保留整数部分。</p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><strong>输入: </strong>"3+2*2"
|
||||
<strong>输出:</strong> 7
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong> " 3/2 "
|
||||
<strong>输出:</strong> 1</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong> " 3+5 / 2 "
|
||||
<strong>输出:</strong> 5
|
||||
</pre>
|
||||
|
||||
<p><strong>说明:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li>你可以假设所给定的表达式都是有效的。</li>
|
||||
<li>请<strong>不要</strong>使用内置的库函数 <code>eval</code>。</li>
|
||||
</ul>
|
Reference in New Issue
Block a user