Yes, I output always number with three digits after decimal point.
Algorithm is simply:
when I read another event on the road, I calculate fuel consumed between current and last event:
- Code: Select all
actFuel += (actKm - lastKm)*(actFuelConsumpton/100.0 + actLeakNo)
After that I manage action connected to particular event and read another one until I reach Goal event.
Every gas station on the road is special - I check if between start (or another gas station) car used more fuel than in maximal case - if I exceed computed erlier maximum I remember it.
If I reach goal I output found maximum.
I tried to post to versions of code:
1) in the first I used directly formula specified above (WA)
2) in the second I used only integer calculations (formula is a bit different to correct handle decimal and fractional parts) (WA)
It's nice that somebody remembered me
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)