题解 | #获得月份天数#
获得月份天数
https://www.nowcoder.com/practice/13aeae34f8ed4697960f7cfc80f9f7f6
#include <stdio.h>
int main()
{
int Pmonth[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int Rmonth[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int month,year;
int n;
while( (n=scanf("%d%d",&year,&month))==2 )
{
if (year%4==0&&year%100!=0||year%400==0) {
printf("%d\n",Rmonth[month]);
}
else {
printf("%d\n",Pmonth[month]);
}
}
return 0;
}
