#include <leetcode.h>
◆ dayOfTheWeek()
string leetcode::day_of_the_week::Solution::dayOfTheWeek |
( |
int |
day, |
|
|
int |
month, |
|
|
int |
year |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 475 行定义.
476 const string output[] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"};
477 const int dayofmonths[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
479 count += (year - 1971) * 365;
480 count += (year - 1) / 4 - 1970 / 4;
481 for(
int m = 0; m < month - 1; m++) {
482 count += dayofmonths[m];
484 if(month > 2 && year % 4 == 0 && year % 100 != 0) {
489 return output[count];
被这些函数引用 leetcode::day_of_the_week::TEST().
该类的文档由以下文件生成: