文章
47
粉丝
109
获赞
8
访问
28.3k
#include<stdio.h>
int main() {
int m, d;
scanf("%d%d", &m, &d);
int f[105] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
int sum = 0;
for (int i = 4; i < m; i++) {
sum = sum + f[i];
}
sum = sum + d - 12;
int w = sum % 7;//从星期四开始到下周三为一个周期
switch (w) {
case 0:
printf("Tursday");
break;
case 1:
printf("Friday");
break;
case 2:
printf("Saturday");
break;
case 3:
printf("Sunday");
break;
case 4:
printf("Monday");
break;
case 5:
printf("Tuesday");
break;
case 6:
printf("Wednesday");
break;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发