Tuesday 15 June 2010

algorithm - Project Euler #19. Trouble Understanding -



algorithm - Project Euler #19. Trouble Understanding -

so started problem 19 thinking easy, don't think understand question asking.

the question:

you given next information, may prefer research yourself.

1 jan 1900 monday. 30 days has september, april, june , november. rest have thirty-one, saving feb alone, has twenty-eight, rain or shine. , on jump years, twenty-nine. jump year occurs on year evenly divisible 4, not on century unless divisible 400.

how many sundays fell on first of month during twentieth century (1 jan 1901 31 dec 2000)?

as understand this, find asking how many sundays there in jan of each year 1901-2000. there around 3 sundays in each month (that's lowballing it) , on 100 years, that's 100 januaries, 100*3 around 300.apparently it's around 100 wrong question if explain me question asking, great.

it's not asking how many sundays in january. it's how many times month started sunday.

if check calendar year 1900, can see apr 1 sunday , july 1 sunday. year, there 2 months meet criteria. the year 1901 has 2 days meet criteria 1 time again (september 1 , dec 1), , the year 1902 has 1 day (june 1).

algorithm

No comments:

Post a Comment