Problem 1909. Two fractions, one sum
Solution Stats
Problem Comments
-
5 Comments
Although people have solved this already. I'm sure that there's an error in the 7th test suite.
two_fractions(10^7) = 113;
two_fractions(10^8) = 165;
two_fractions(two_fractions(10^7) + two_fractions(10^8)) ==> two_fractions(278) = 5 ==> not 14
Nick, I see where your problem is: two_fractions(10^8) is not 165. You are running into rounding errors on some of your larger fractions.
Ok Thanks. I'll have a look.
http://www.wolframalpha.com/input/?i=%28x%2By%29*5+%3D+x*y
Nice problem!
Solution Comments
-
2 Comments
What's going on, why even test 2 fails?
I think it was a new issue with the test suite. There was a test case that was somehow commented out (X=1,Y=1) because it didn't have a blank line before it. I added %% in front of the first case in the test suite, and put the x=1;y=1 case on the next line. Your y=32 test (now test 3) works properly now. I'll rescore your other submission.
-
2 Comments
Not the nicest, but what's wrong here, works in my pc???
I rescored this solution, but it's timing out now. While it may work on your machine, Cody needs it to run a bit faster.
-
1 Comment
There might be some general issue with your jailbreaking protections, but in any way if you really want to disallow 'freepass' solutions to your problem simply add at the beginning of your testsuite the lines: try, freepass.disable; end. Hope this helps!
Problem Recent Solvers13
Suggested Problems
-
1312 Solvers
-
1458 Solvers
-
323 Solvers
-
Get the elements of diagonal and antidiagonal for any m-by-n matrix
440 Solvers
-
629 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!