Skip to content

11520: 【原1520】模拟计算器(基础版)

题目

题目描述

author: 林泽冰 原OJ链接:https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1520

Description

Implement a basic calculator to evaluate a simple expression string.

The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spaces . You may assume that the given expression is always valid. The answer is not bigger than 2^31.

(This is the problem B for SEIEE-Yu Yong Data Structure 2015 Fall Exam 1)

Input Format

One rows, the expression.

Output Format

One rows, the answer.

Sample Input

1 + 1

Sample Output

2

Limits

  • 20% No “()” Included
  • 30% Iess than 3 “+” or “-” or “()”
  • 100% Less than 10000 “+” or “-” or “()”

Oops! 本题目还没有解答!

助教老师们编题的速度,已经超过了解题的速度!

OJ翻了一新,但本解答集还大多用的是2017-2019级,甚至更早的同学们贡献的答案。

如果你已经AC了,可以的话,请您参考添加页面,与大家一起分享你的题解!