杭电1201求助--18岁生日
#include<stdio.h>int main()
{
int year,month,i,day,sumday=0,t;
scanf("%d",&t);
while(t--)
{
sumday=0;
scanf("%d-%d-%d",&year,&month,&day);
sumday+=18*365;
for(i=year;i<=(year+18);i++)
if((i%4==0&&i%400!=0)||(i%400==0))
sumday++;
if(month==2&&day==29)
{
printf("-1\n");
continue;
}
if((year%4==0&&year%400!=0)||(year%400==0))
if(month>2)
sumday-=1;
year+=18;
if((year%4==0&&year%400!=0)||(year%400==0))
if(month<=2)
sumday-=1;
printf("%d\n",sumday);
}
return 0;
}