Community Puzzle: Simple Fraction to Mixed Number

Thank you, it passes fine. Also tried 2/-2 -1, -2/-2 1.

If you want to PM me your code, I can probably figure out where it falls down.

  • danBhentschel

This could also be a big-number-error.
Now that the puzzle has been approved, these errors are popping up and I cannot edit the visible test cases anymore. If I could, I would add cases like this:

0/-174
-0/-174
999999/-999999
-999999/-999999
-999999/999999

as well as some more “big number” cases.

As an option, the last validation test could be added to visible test cases but in re-ordered form, so that it has the same fractions but in different order.

Thanks for sending me the code. MMMAAANNN is correct. You time out on big numbers. Try this test case:

10
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067
7338162/8696067

Should give:

2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689
2446054/2898689

Your code currently times-out on this.

  • danBhentschel
1 Like

I’m stuck as well with the “some for sign handling” at validation phase. All the tests run smoothly, I am running short of ideas on where my mistake could be. What should be solutions for
0/-174
-0/-174
My understanding of the rules is that it should give zero in both case, but is it correct?

That is correct. Both should be zero.

  • danBhentschel

Thanks, i made the same mistake :). how did you see the overflow?

By chance, I have moderation rights on community puzzles, and still had a link to the draft on my notifications, so I could peek to see how the validators look like ^^

I’m having the same issue, I’ve run every test I’ve seen here in the forum posts, big numbers and mixed negatives included, and they all come out correct… but I’m only getting 75% on the validation. Some more sign handling, and many random cases just won’t pass. I’ve racked my brain trying to figure out where the issue is. If anyone could help point me in the right direction, that would be super.

I will help out anyone who pm’s me with complete source code.

  • danBhentschel

I’m at 100% IDE and stuck at the last validation case “many random cases”. I haven’t seen the pre-approved puzzle so no idea what’s in that test case. Any idea what I might have missed?

SOLVED: I forgot to check for the case where x / x = 1, that should be added to the test cases.

I have added that case to the tests, along with several other cases that have tripped up others in the past. Thanks for the suggestion.

  • danBhentschel
1 Like

Thank you for updating this puzzle, player_one. I did not know that now published puzzles are editable!

Only by gold members.

I am stuck at this question, I wrote 2 applications of a method I use (one is faster and the other is more careful about memory) and both of them fails the first test in validation. the faster one also fails the 3rd test . I am quite sure that overflow should not be an issue ( I don’t even make any sums) , I do handle signs and everything I can think of.

Thanks for the update to the puzzle. I saw the problem instantly once I got the output from that new test case. I completely forgot to add a test for signs on non-mixed numbers with both negative numerator and denominator. Quick and easy fix.

Hi, I have passed in the IDE but stuck in the first test case of submission.
I have passed all test cases in this thread also.
Any hint?
Thanks a lot!

1 Like

I passed also all IDE testc ases but i got stuck at the last validator. Has this validator anything that is new? or is my code just too slow?

1 Like

It doesn’t seem to have something new.

My code passed all the tests too but not the last validator, any idea ?

=> my code was too slow