You are viewing a single comment's thread. Return to all comments →
hint: use bc -l. Use 'scale' or an equivalent for appropriate decimal places! As you can see, many have got this challenge right. 17.92857 rounds off to 17.949 when corrected to 3 decimal places.
I have used bc -l along with scale , still it rounds off it to 17.92857
Use a bc scale that's higher than printf's.
e.g. Use scale=4 together with printf "%.3f". Only then you'll get hackerrank's expected result.