【CodeForces】[659A]New Year and Days

这里写图片描述

找规律题目
已知平年有52周零1天
闰年有52周零2天

2016年为闰年,并且第一天为周五
所以一年有53个周五周六,其余为52

一年有12个月有29号
一年有11个月有30号
一年有7个月有31号

#include<stdio.h>
int main() {
    int n;
    char s[10];
    while(scanf("%d of %s",&n,s)!=EOF) {
        if(s[0]=='w')
            printf("%d
",n==5||n==6?53:52);
        else
            printf("%d
",n<30?12:(n==30?11:7));
    }
    return 0;
}

题目地址:【CodeForces】[659A]New Year and Days

原文地址:https://www.cnblogs.com/BoilTask/p/12569507.html