16 若 a=4,b=3,c=2,d=5,e=10,f=2,g=3,h=2,則後置式(Postfix)數學式 abcd*ef/+gh*-+-的運算結果為何?
(A)-290
(B)-8
(C)10
(D)144

答案:登入後查看
統計: A(24), B(223), C(119), D(32), E(0) #2574655

詳解 (共 5 筆)

#4824276

abcd*ef/+gh*-+-

=ab(c*d)(e/f)+(g*h)-+-

=ab((c*d)+(e/f)-(g*h))+-

=a(b+((c*d)+(e/f)-(g*h)))-

=a-(b+((c*d)+(e/f)-(g*h)))

=a-(b+((c*d)+(e/f)-(g*h)))

=4-(3+((2*5)+(10/2)-(3*2)))

=4-(3+(10+5-6))

=-8

18
0
#5502748

中置式 => 後置式
將右括號取代為左邊最接近的運算子(從最內層括號開始)

後置式 => 中置式(回推)
從算式左邊往右掃,找到運算子就往左邊湊兩個運算元
  abcd*ef/+gh*-+-
        
ab(c * d)(e / f)+ (g * h)-+-

ab(c * d)(e / f)+ (g * h)-+-

ab((c * d)+ (e / f))(g * h)-+-

ab((c * d)+ (e / f))(g * h)-+-

ab((c * d)+ (e / f)) -(g * h)+-

ab((c * d)+ (e / f)) -(g * h)+-

a(b+((c * d)+ (e / f)) -(g * h))-

a  -(b+((c * d)+ (e / f)) -(g * h))

數字代入 : 

4  -(3+((2 * 5)+ (10 / 2)) -(3 * 2))
= 4 - (3+(10+ 5) - 6)
= 4 - 12 
= 8

5
0
#4526693
後式 abcd*ef/+gh*-+- ...
(共 57 字,隱藏中)
前往觀看
4
0
#5333533
                  - ...
(共 292 字,隱藏中)
前往觀看
0
0
#5967928
a+b-(((c*d)+(e/f))-(g*h))
0
0