//首先要知道闰年的定义,四年一闰,百年不闰,四百年再闰
#include <stdio.h>
int main(){
int year = 0, month = 0;
int ping[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; //平年时各个月的天数,2月28天
int run[12] = {31,29,31,30,31,30,31,31,30,31,30,31}; //闰年时各个月的天数,2月29天
while(scanf("%d %d", &year, &month) != EOF)
{
if((year % 4 == 0 && year % 100 !=0) || (year % 400 == 0))
//非整百年能被4整除,或者整百年能被400整除,则为闰年
printf("%d\n", run[month-1]); //数组下标从0开始,与月份相差1else
printf("%d\n", ping[month-1]);
}
return 0;
}