Problem 57 I have the correct result but Im failing because the expected result is not consistent

Back to General discussions forum

Zahand     2015-10-25 23:52:20

By looking manually through the expected results and my results I can see that I get exactly what the answer is, but the expected result is not consistet with the precision.

For example

Expected Result:

#   10 deicmals   10 decimals        11 decimals   10 decimals
... 14.9333333333 10.8666666667 10.4 8.03333333333 13.6333333333 15.2 ...

My result:

#   10 decimals   10 decimals        10 decimals  10 decimals
... 14.9333333333 10.8666666667 10.4 8.0333333333 13.6333333333 15.2 ...

99% of the times it uses 10 decimal places, but all of the sudden it used 11 instead. This makes me fail the problem.

I tried not setting the number of decimal places I want, but that doesnt help either. Please fix this problem.....

Rodion (admin)     2015-10-26 04:30:49
User avatar

Hi!

Thanks for your message, but the problem is not about precision. For float answers we usually allow some inexactness.

I just had a peek at your code - it seems to print out one value less than expected. E.g. if you try the example given in the problem statement - with 7 points - it prints out only 6 values.

I'm afraid that is why the answer is not accepted :(

Though I hope it would be easy to fix!

Zahand     2015-10-26 14:00:37

Thank you! I had made some changed to my code and forgot to change all the occurrences that is why my indexing was wrong :)

Please login and solve 5 problems to be able to post at forum