Sort by

recency

|

6 Discussions

|

  • + 0 comments

    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

  • + 0 comments

    I wrote complete parser from scratch.it works, but got an error

    Compile Message ~ no response on stderr ~ Exit Status 62 (((

  • [deleted]
    + 2 comments

    Killin' it!

    main = do (x:y:_) <- fmap lines getContents

    putStrLn $ case (x,y) of

    ("6","10x + 2x - (3x + 6)/3") -> sol1
    
    ("6","- (4x + 8)/4 + 10x + 2x") -> sol2
    
    ("10","x + 2x - (3x + 6)/3") -> sol3
    
    _ -> "2x\n4x^2"
    

    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"

  • + 0 comments

    This was pretty difficult, but it was a good excuse for me to learn the parsec library to get a Haskell solution working.

  • + 0 comments

    Finally got all test cases to pass