文章

25

粉丝

364

获赞

8

访问

219.0k

头像
简单计算
P1011 贵州大学机试题
发布于2021年1月17日 13:42
阅读数 8.5k

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *week[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main()
{
    int month, day, sum;

    scanf("%d%d", &month, &day);

    sum=day-12+4;
    for (int i = 0; i < month - 4; i++)
    {
        sum += days[i+3];
    }
    printf("%s", week[sum % 7]);

    //system("pause");
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发