Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: How preparing the weekly shift roster led to a fascinating discovery...

by lidden (Curate)
on Dec 14, 2007 at 22:31 UTC ( [id://657132] : note . print w/replies, xml ) Need Help??


in reply to Re: How preparing the weekly shift roster led to a fascinating discovery...
in thread How preparing the weekly shift roster led to a fascinating discovery...

Very nice++.

But there is a little thinko in there. Because Jan 31 next year is a +0 day next year does not mean it is this year. For a non leap year it is +6 and +5 for a leap year.

Replies are listed 'Best First'.
Re^3: How preparing the weekly shift roster led to a fascinating discovery...
by CountZero (Bishop) on Dec 15, 2007 at 07:34 UTC
    Yes, but it doesn't matter for the problem at hand. January of the previous year can at most be one day off its normal, non-leap day, but it can never become a "+3".

    To explain in a bit more detail what you have already found: As a normal year has 52 weeks and one day, January of the same year must thus be a "-1" (or "+6") compared to the day of the 1st of March of the same year.

    In a leap year, (52 weeks and two days) January 31st will be a "-2" (or "+5") day, but it can never ever be a "+3" day.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James