EXPR2 - Analyse Simple Arithmetical Expressions

no tags 

You are to write a program to analyse some simple arithmetical expressions. The BNF form of the defination of the expression is below.

<expression>::=<num><oper><num>
<num>::=0|1|2|...|99
<oper>::=+|-|*

Tip: You may find this problem is like the problem GALAXY very much. To get round of the programming problems of using Brainf**k, Whitespace or Intercal, you must use C/C++/Pascal/Java to do the programming. Seems easy? Now there is an additional objective: there must not be any semicolons ";" in your program!!!

Input

Multiple test cases, the number of them T is given in the very first line, T<=99. (In the judge data, T = 99.)

Each test case contains one line with a correct expression, without leading or trailing spaces.

Output

For each test case you should output one line contains the result of the expression without any leading zeros. You may assume this number is always a non-negative one.

Example

Input:
3
6*7
67-25
31+11

Output:
42
42
42

Score

Thanks to Jin Bin's suggestion, I've changed this problem from a classical one to a challenge one. Suppose the number of non-whitespace characters(ASCII 33 - 126) in your solution is K, the your score is floor(K3/1000)+1.

Note

The judge had something wrong and it has been fixed on Jul.1, 2008. Please accept my apology.

Note 2

Sorry to some users, but the C function "system()" is prohibited in this problem. Judge has been modified. Use problem CE to practice your programming skills without any(?) restrictions.


hide comments
rajashree_85: 2021-06-03 07:53:04

Finallllllly ac:)

Last edit: 2021-06-03 07:53:36
reza_saker123: 2018-03-02 01:46:33

how to write code in c or cpp without semiclones; I don't understand. Can anybody please explain in brief??

i_am_anb: 2016-05-23 18:47:45

why its saying WA for some banned keyword ? any suggestions ?

dwij28: 2016-01-21 10:43:26

The judge is faulty. I have got AC but in some solutions when i have tried optimizing the solution, I have got wrong keyword error for no reason.. I have not used system() or semicolons.. I have used define keywords for some of my code that is redundant but even my AC solution uses define, it has not thrown error in that case..

lt: 2015-10-13 13:27:38

It's not possible for java to solve this problem!

Mitch Schwartz: 2015-05-09 21:23:28

Email sent to Piotr KÄ…kol regarding updating the judge.

Soma: 2014-06-01 11:51:48

what should we print if the output is 0(expression value is 0)

Bhavik: 2014-02-16 20:34:23

new thing to learn:)

Somesh Maurya™: 2013-08-20 04:31:31

what the f**k was that i got 0 points my submission ID is 9873228

OTAKU: 2013-07-21 19:18:09

Hello sir,my solution is accepted but i got 0. please help me ,my submission id is
9694649


Added by:Fudan University Problem Setters
Date:2007-11-03
Time limit:2s
Source limit:17000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C CPP JAVA PAS-GPC PAS-FPC
Resource:A copy of problem GALAXY, with language restrictions modified