回分類題庫
d219: CP2 Lab Exercise: Infix to Postfix
出處:

Difficulity : N/A
Accepted : 39 Times | Submit :96 Times | Clicks : 1636
Accepted : 27 Users | Submit : 27 Users | Accepted rate : 100%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2011-05-25 15:25

Content :

Please convert a infix math formula into postfix.

Input :

Each line contains an infix formula separated by space and max length is 301. Each operand is at most 5 chars.

Operators: +, -, *, /, %(mod)  , (, )

Precedence:  () > *, /, % > +, -

If the precedence is equal, then follow form left to right.

Output :

Output the postfix result separated by space in a line for each test case.

Sample Input :

2 + 3
AAA * BBB
( 2 + 3 ) * 5

Sample Output :

2 3 +
AAA BBB *
2 3 + 5 *

Hint :


  

Author :


  Solve it!   Status Forum (0)

C++
C
JAVA
61010. jxcode (8 ms , 162KB)
32248. cp99703009 (2 ms , 208KB)
31911. cp99703008 (2 ms , 246KB)
36194. king_of_laba (4 ms , 242KB)
32224. cp99703040 (4 ms , 242KB)
32159. cp99703039 (4 ms , 216KB)
53922. nwgs524513cja (82 ms , 184KB)
53128. nwgs524513cja (106 ms , 178KB)
50682. nwgs524513cja (124 ms , 150KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡