Correctness of Sakamoto's algorithm to find the day of week
问题 I am using Sakamoto\'s algorithm to find out the day of week from a given date. Can anybody tell me the correctness of this algorithm? I just want this from 2000 to 2099. The algorithm from Wikipedia is given for reference. int dow(int y, int m, int d) { static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; y -= m < 3; return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7; } 回答1: Well, you can tell just by looking at it that it is correct... Assuming that the t[] array is correct, which you can