#include <stdio.h> int main() { int year, month; int arr[]={0,31,28,31,30,31,30,31,31,30,31,30,31};//数组下标对应月份 while (scanf("%d %d", &year, &month) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to if(year%400==0&&month==2) arr[2]=29; else if(year%100!=0&&year%4==0&&month==2) arr[2]=29; else arr[2] =28; printf("%d\n",arr[month]); } return 0; }