ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1759. Long-Livers

WA19: using java's Date to calculate time difference is a mistake - it calculates it in not trivial way
Posted by messir 27 Aug 2010 08:06
Re: WA19: using java's Date to calculate time difference is a mistake - it calculates it in not trivial way
Posted by Moonstone 27 Aug 2010 10:51
I also had WA 19. There are some tricks to get AC in Java using java.util.Date. Take your tambourine and let's go!

1. Divide milliseconds count by 24*60*60*1000.
2. January's index is 0, not 1.
3. Use, for example, year-1500 instead of year.
4. Use Date's deprecated constructor.
Re: WA19: using java's Date to calculate time difference is a mistake - it calculates it in not trivial way
Posted by ucs6 26 Apr 2012 12:00
You don't have to care about all those details.
Use GregorianCalendar it will take care everything for you.