题解 | #获得月份天数#
获得月份天数
http://www.nowcoder.com/practice/13aeae34f8ed4697960f7cfc80f9f7f6
#include<stdio.h>
int main()
{
int year,day;
while(scanf("%d %d",&year,&day)!=EOF)
{
if(day==1||day==3||day==5||day==7||day==8||day==10||day==12)
{
printf("31\n");
}
else if(day==4||day==6||day==9||day==11)
{
printf("30\n");
}
else if( year % 400 ==0 )
{
printf("29\n");
}
else if(year % 4 == 0 && year % 100 != 0)
{
printf("29\n");
}
else
{
printf("28\n");
}
}
return 0 ;
}