I just recently came across the GregorianCalendar class in Java. http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html
I tried to see if it works well by using it for this practice problem -> http://codeforces.com/contest/304/problem/B
After writing the code, I tested the two given sample cases on my computer and it gives the right output. Nice! Ctrl+A -> Ctrl+C -> Ctrl+V -> Submit! But to my utter dismay, "Wrong Answer on pretest 1". I am dumbfounded and have no idea why this is happening.
Here are my (almost identical) submissions: http://codeforces.com/contest/304/submission/4106624 -> WA on pretest 1 (Why!?) http://codeforces.com/contest/304/submission/4106538 -> WA on pretest 2 (Why!?) http://codeforces.com/contest/304/submission/4107237 -> Accepted (How is this different!?)
Can anybody explain why this is so?