波兰表达式
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
【题目描述】
波兰表达式是一种把运算符前置的算术表达式,例如普通的表达式2 + 3的波兰表示法为+ 2 3。波兰表达式的优点是运算符之间不必有优先级关系,也不必用括号改变运算次序,例如(2 + 3) * 4的波兰表示法为* + 2 3 4。本题求解波兰表达式的值,其中运算符包括+ - * /四个。
【输入】
输入为一行,其中运算符和运算数之间都用空格分隔,运算数是浮点数。
【输出】
输出为一行,表达式的值。
可直接用printf("%f\n", v)输出表达式的值v。
【输入样例】
* + 11.0 12.0 + 24.0 35.0
【输出样例】
1357.000000
【来源】
一本通在线评测
C24暑假末竞速赛——数据结构专题
- Status
- Done
- Rule
- Ledo
- Problem
- 5
- Start at
- 2025-8-26 16:45
- End at
- 2025-8-27 22:45
- Duration
- 4 hour(s)
- Host
- Partic.
- 6