ONP - Transform the Expression
Transform the algebraic expression with brackets into RPN form (Reverse Polish Notation). Two-argument operators: +, -, *, /, ^ (priority from the lowest to the highest), brackets ( ). Operands: only letters: a,b,...,z. Assume that there is only one RPN form (no expressions like a*b*c).
t [the number of expressions <= 100] expression [length <= 400] [other expressions]
Text grouped in [ ] does not appear in the input file.
The expressions in RPN form, one per line.
Input: 3 (a+(b*c)) ((a+b)*(z+x)) ((a+t)*((b+(a+c))^(c+d))) Output: abc*+ ab+zx+* at+bac++cd+^*
maintaining two stacks makes it easier
im gettung a runtime error when submitting? can anyone help??
This one WAS stupid-easy, though I will admit I started to overthink it. (Hallmark of a good contest problem!)
suggestion:Don't think deep,its doable!
May Anyone explain this problem?
I solved it pretty easily using stacks by how can i solve it without stack? (Some people have said they have used recursion and some have used if-else blocks)
New to CP still AC in first attempt
no need deep thinking
can anyone one explain this problem!!
|Cluster:||Cube (Intel G860)|
|Languages:||All except: NODEJS PERL6 VB.NET|