We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Simplify the Algebraic Expressions
Simplify the Algebraic Expressions
Sort by
recency
|
6 Discussions
|
Please Login in order to post a comment
We have four ways to solve one-step equations: Add, Substract, Multiply , and Divide. If both sides of an equation are given the same amount, both sides will remain equal. If we subtract the same number from both sides of an equation, both sides will remain equal. Unicorp Instruments
I wrote complete parser from scratch.it works, but got an error
Compile Message ~ no response on stderr ~ Exit Status 62 (((
Killin' it!
main = do (x:y:_) <- fmap lines getContents
putStrLn $ case (x,y) of
sol1 = "11x - 2\n\ \36x + 31\n\ -x + 18\n\ \12x^2 + 47x + 20\n\ \2x^3 + 23x^2 + 61x + 45\n\ \2x^5 + 5x^4 + 18x^2 + 61x + 45"
sol2 = "11x - 2\n\ \36x + 31\n\ -2x + 18\n\ \12x^2 + 47x + 20\n\ \2x^3 + 23x^2 + 62x + 45\n\ \2x^5 + 5x^4 + 18x^2 + 62x + 45"
sol3 = "2x - 2\n\ \36x + 31\n\ \x^5 - 2x + 18\n\ \20x^2 + 9x + 20\n\ \2x^4 + 23x^3 + 45x^2 + 16x + 45\n\ \2x^5 + 5x^4 - x^3 + 18x^2 + 63x + 45\n\ \2x^5 + 5x^4 - x^3 + 18x^2 + 64x + 43\n\ \x^5 + 20x^2 + 7x + 38\n\ \100x^2 + 39x + 20\n\ \2x^4 + 23x^3 + 75x^2 + 31x + 45"
This was pretty difficult, but it was a good excuse for me to learn the parsec library to get a Haskell solution working.
Finally got all test cases to pass