【CodeForces】[611A]New Year and Days

文章字数:139

问题描述

New Year and Days

问题分析

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

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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#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",n==5||n==6?53:52);
        else
            printf("%d\n",n<30?12:(n==30?11:7));
    }
    return 0;
}

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...