a072: The Simple Calculator 簡易計算機
標籤 : String 字串
通過比率 : 100% (7 人 / 7 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2019-03-08 16:43

內容

Please design a simple calculator, the calculator can perform the addition (+) and subtraction (-) function.  The result is calculated when an equal sign (=) is read.

請設計一個簡單的計算機,計算機可以執行加法(+)和減法( - )功能。 讀取等號(=)時計算結果。

輸入說明

The first line has an integer N represents the number of test cases N (1≤N≤10 ). Each line represents an arithmetic expression.  There are three operators may be used in the expression, including addition (+), subtraction (-), and equal (=).  The range of the operand is from -9999 to 9999.  When the equal sign is read, the result is calculated.

第一行具有整數N表示測試用例數N(1≤N≤10)。 每行代表一個算術運算式。 運算式中可以使用三個運算子,包括加(+),減(-)和等號(=)。運算元的範圍是從-9999到9999.當讀取等號時,計算結果。

輸出說明

Please print the answers of arithmetic expressions.

請輸出算術運算式的答案。

範例輸入
4
25+5-10-2=
15+30=
88+99-10=
0+1+2+3+4+5+6+7+8+9+10=
範例輸出
18
45
177
55
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (50%): 1.0s , <1K
隱藏 測資點#1 (50%): 1.0s , <1K
提示 :
標籤:
String 字串
出處:
線上協同學習平臺 - ITSA 教育部資通訊軟體創新人才推升計畫 [編輯 :
zero_jason (zero_jason(MANAGER))
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」