#include <stdio.h> int main() { //存放一年中各月份的天数 int days[] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; int y = 0; int m = 0; //多组输入 while (~scanf(" %d%d", &y, &m)) { int day = days[m - 1]; //判断闰年的二月 if (((0 == y % 4 && 0 != y % 100) || 0 == y % 400) && m == 2) { day++; } printf("%d\n", day); } return 0; }