struct DAY                          //利用结构体列出天数,复习结构体试试,其实没必要
{
    int dy;
    int xy;
    int py;
    int ry;
}day = {31, 30, 28, 29};


void The_date(int m,int f)         //天数输出函数
{
    switch(m)                      //采用switch-case结构
    {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            printf("%d\n",day.dy);
            break;
        case 2:
            if(f == 1)
            {
                printf("%d\n",day.ry);
            }
            else
            {
                printf("%d\n",day.py);
            }
            break;
        case 4:
        case 6:
        case 9:
        case 11:
            printf("%d\n",day.xy);
            break;
    }
}
int main()
{
    int year,month;
    while(~scanf("%d %d",&year,&month))
    {
        int flag = 0;                                                
        if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0)     // 闰年
        {
            flag = 1;                                              //是闰年置1
            The_date(month, flag);
        }
        else
        {
            The_date(month, flag);
        }
    }
    return 0;
}