1091 D 求解逆波兰表达式(Calculate the reverse Polish notation)

该问题要求编写一个函数,计算给定的逆波兰表达式,其中操作数为1位数,包含加减乘除四种运算符,且除法结果为整数。例如,表达式23+4*的结果为20。
摘要由CSDN通过智能技术生成

Problem D

求解逆波兰表达式(Calculate the reverse Polish notation)

时限:1000ms 内存限制:10000K 总时限:3000ms

描述:

 

编写函数int add(char s[]);计算字符串形式的逆波兰表达式(即两个操作数在前,计算符在后)。本题内,保证每个操作数均为1位数。操作符有'+','-','*','/'四种。且保证计算过程中除法运算全部为整数除法,结果为整数。
如23+4*,,结果20
Write a function int add (char s []); Calculate the string form of reverse Polish notation (ie, the first is two operands, then the operator). This problem, to ensure that each of the operands are 1-digit. The operator have only four: '+', '-', '*', '/'. And to ensure that the division operation in the calculation process for all the integer division, the result is an integer.
Such as 23+4*, the result is 20.

输入:

 

一行字符串,长度不超过20。
Input

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值