#include <stdio.h>
int b(int year, int month, int day) {
if (month < 3) {
month += 12;
year--;
}
int c = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7;
return c;
}
int main() {
int year, month, day;
printf("请输入年份:");
scanf("%d", &year);
printf("请输入月份:");
scanf("%d", &month);
if (month <= 0 || month > 12) {
printf("别几把乱输,小心我揍你\n");
return 0;
}
printf("请输入日期:");
scanf("%d", &day);
int d;
switch(month) {
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
d = 31;
break;
case 4: case 6: case 9: case 11:
d = 30;
break;
case 2:
if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
d = 29;
else
d = 28;
break;
default:
printf("我让你飞起来\n");
return 0;
}
if(day <= 0 || day > d) {
printf("再乱输我让你飞起来\n");
return 0;
}
int a = b(year, month, day);
if (year == 2023 && month == 11 && day == 7) {
printf("2023年11月7日是一个值得纪念的日子这天是星期");switch(a) {
case 0:
printf("一\n");
break;
case 1:
printf("二\n");
break;
case 2:
printf("三\n");
break;
case 3:
printf("四\n");
break;
case 4:
printf("五\n");
break;
case 5:
printf("六\n");
break;
case 6:
printf("日\n");
break;
default:
printf("别几把乱输数字\n");
}
} else if (year > 2003 && month == 9 && day == 6) {
int b(int year, int month, int day) {
if (month < 3) {
month += 12;
year--;
}
int c = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7;
return c;
}
int main() {
int year, month, day;
printf("请输入年份:");
scanf("%d", &year);
printf("请输入月份:");
scanf("%d", &month);
if (month <= 0 || month > 12) {
printf("别几把乱输,小心我揍你\n");
return 0;
}
printf("请输入日期:");
scanf("%d", &day);
int d;
switch(month) {
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
d = 31;
break;
case 4: case 6: case 9: case 11:
d = 30;
break;
case 2:
if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
d = 29;
else
d = 28;
break;
default:
printf("我让你飞起来\n");
return 0;
}
if(day <= 0 || day > d) {
printf("再乱输我让你飞起来\n");
return 0;
}
int a = b(year, month, day);
if (year == 2023 && month == 11 && day == 7) {
printf("2023年11月7日是一个值得纪念的日子这天是星期");switch(a) {
case 0:
printf("一\n");
break;
case 1:
printf("二\n");
break;
case 2:
printf("三\n");
break;
case 3:
printf("四\n");
break;
case 4:
printf("五\n");
break;
case 5:
printf("六\n");
break;
case 6:
printf("日\n");
break;
default:
printf("别几把乱输数字\n");
}
} else if (year > 2003 && month == 9 && day == 6) {