[Community Puzzle] The Frog Jump 1

“Distances are in meters, rounded to the nearest centimeter. That is, distances are rounded to the nearest multiple of 0.01”

What do you get when you round your 0.0363 and 0.0771 jump distances? :wink:

Thanks for making me feel so stupid ! :grinning:
I read this “rounded” statement but I didn’t measure it was useful in this context.

Thanks @Mercy38

Still got this validator problem (using Python3) for the 6th case. Any idea ?

Is it the 0,0 validator?

Yep. I finally found the solution. It seems the problem was that I was looping through the list to find the position of my frog. I rather inserted my computed distance into the list, sorted / reversed the list and output the index+1 of my computed distance.
Thanks for your help.

I am a bit confused, “The frog isn’t at 0 0” validation fails.
All test cases pass and all other validation tests pass.
I do use the frog’s starting position and cant think of the problem.
My frog in the same test case has a jump length of 3.94m if that helps compare with other peoples results.
Did anybody experience this and what was changed to get100%?

What if your frog is the last one?


I never considered that possibility!

100% achieved, thanks for the hint.


Hello, I have a problem with the resolution : all my tests pass.
But the test n°7 (“A different angle”) of the validator don’t pass.

I double check, the angle can be whatever the results seems to be the one expected (0 meter if angle == 90°, negative x if angle is between 91° and 179°, etc.).

Can someone tell me what’s wrong ? Thank you in advance :slight_smile:

I did not use initialX, initialY, mass and a and still got 100%.
I think there’s something wrong with the Validator or my Solution is just lucky…

Same as @Hodvidar-Achille. No clue why. On Submit this test fails

Dear i also was unable to submit one test.
i found the solution.
My loop for checking the position was one to small.

for (int i = 0; i < frogNumber; i++)

changed to

for (int i = 0; i < frogNumber+1; i++)

and it was oke

Kind regards

for (int i = 0; i <= frogNumber; i++)

will also work

I don’t understand how this did not cause you an “out of range” exception @BartSw.
I didn’t pass validators 6 and 7 either, and for me the solution was different:

I had an array with the frog distances sorted in descending order, I was going through it and stopped when I found a value smaller than the value of my frog (meaning that it was the first frog that was less strong than mine).

Instead, I proceeded more simply: I added the value of my frog to my array, THEN I sorted it in descending order, and finally I just had to find the index of the value of my frog in this list (+ 1, because frog positions start at 1 while the index of my list starts at 0).

Good luck!

Hi @tarapitha,@dbdr.

I passed all the test cases, but the validator indicates as follow even if I have no hard coded solution
“The following validators differ from the puzzle test cases to prevent hard coded solutions.”

So what should I do to get 100% ???

Thanks :wink:

Hello! This information is too scarse :slight_smile: The validator should display the case numbers that result in nonmatching answers. Could you please include the problematic case numbers here? You could also check for rounding errors or exceptions generated by division by zero or square root from negative numbers.

Thanks for your answer.

I’ve checked for rounding errors and other exceptions, but did not get the point.

When I play the test cases, I get success for all of them, but when I try to submit the code, the case n°6 - The frog isn’t at 0 0 appears in red with the message :
The following validators differ from the puzzle test cases to prevent hard coded solutions. This is why you can have some fails here even if all of the tests provided in the IDE have been successfully passed.

Hodvidar: I have a problem with the resolution : all my tests pass.
But the test n°7 (“A different angle”) of the validator don’t pass.

Can you pass this custom test?
0.04 0.07 0.09 0.10 0.10 0.11 0.1 0.09
0 0
0 -9.81

I found out that comparing float to double can give you unexpected results. So I would suggest not mix them up.

For me the validator of “frog on a diet” failed which is super weird because nowhere in the calculations is the mass take care into.