I'm currently trying to solve some problems on the USACO training website in preparation for unrelated competition in C ++.
However, I am stuck in this problem:
Is the 13th of a month on Friday Friday less common than on any other day of the week? To answer this question, write a program that will calculate the frequency that the 13th of every month lands on Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday for a certain period of N years. The time period for testing will be from January 1, 1900 to December 31, 1900 + N-1 for a certain number of years, N. N is non-negative and will not exceed 400.
The number N is provided in the input file, and the output should be a file with seven numbers in it, each of which represents the number of the 13th fall on a specific day of the week.
I was wondering how you guys approach this issue. I'm not looking for code or anything else, as this will simply defeat the goal of my execution, instead, only the starting point or algorithm will be useful.
So far, the only thing I could think of was to use the Doomsday Algorithm, however, I'm not sure how to implement it in the code.
Any help would be greatly appreciated.
source share