<PREV Problem:
NEXT>
Solved by 587 users: ...
UserDateAttemptTimeCMSC
sb3ar03 may 2008Ruby2400.0220 
sb3ar03 may 2008Ruby2300.0221 
Nakilon20 feb 2010Ruby1500.0224 
Nakilon20 feb 2010Ruby1400.0228 
Nakilon20 feb 2010Ruby1000.0230 
Nakilon20 feb 2010Ruby1300.0230 
Nakilon20 feb 2010Ruby800.0235 
sb3ar11 dec 2007Ruby2100.0237 
pinya15 dec 2007Ruby600.0239 
pinya15 dec 2007Ruby700.0239 
pinya15 dec 2007Ruby800.0240 
pinya15 dec 2007Ruby500.0242 
pinya15 dec 2007Ruby900.0243 
evg28122 aug 2006Perl100.0647 
sb3ar11 dec 2007Ruby2000.0251 
sb3ar22 apr 2007Ruby900.0254 
Morozova_17523 may 2012Python400.0694 
stasg727 nov 2009Ruby300.0295 
xtender16 apr 2010Perl900.0695 
stasg727 nov 2009Ruby200.0299 
lodin29 sep 2006Perl100.06101 
provodok25 jul 2009Python200.06103 
Vladimir_Sitnikov12 dec 2005C++400.02107 
Languages
C++
295
FPC
136
C
88
Java
26
Kylix
26
Ruby
9
Python
7
Perl
4
Scheme
2
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Arithmetica 1.0

Time limit = 5 second(s)

Memory limit = 33000 Kb

You are the main programmer of Walfram Research Corp.

You should wrigh program Arithmetica v1.0, that works as calculator.

Arithmetica v1.0 calculates arithmetic expressions over integer numbers (not very long) constructed from brackets ( ) and binary operators + — *. Unary minus is also allowed.

Operators have equal priority and should be calculated from left to right. It means that 1+1*2=4.

The number of symbols in input expression less than 1000.

Input One line with correct arithmetic expression less than 1000 symbols. Consider all numbers emerging during calculation of the expression small in absolute value, less than 230. Arithmetics of long integers will be realised in future versions.

Output One integer number — result of calculations.

Input#1
1+1
Output#1
2
Input#2
-1+(2*3)
Output#2
5
Input#3
1+(1+(1+(1-1)*2)*2)*2
Output#3
14
Input#4
(((-1)))
Output#4
-1
Input#5
-1000*1000
Output#5
-1000000

Author:
Voroztsov Artem
26 March 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 3.228.11.9