标签:
1 #include<cstdio> 2 using namespace std; 3 4 bool judge(int year) 5 { 6 if((year%4==0&&year%100!=0)||year%400==0) 7 return true; 8 return false; 9 } 10 11 int main() 12 { 13 int count,year,month,day; 14 int t,i; 15 scanf("%d",&t); 16 while(t--) 17 { 18 count=18*365; 19 scanf("%d-%d-%d",&year,&month,&day); 20 if(month==2&&day==29) 21 { 22 printf("-1\n"); 23 continue; 24 } 25 for(i=year+1;i<=year+17;i++) 26 { 27 bool flag=judge(i); 28 if(flag) 29 count++; 30 } 31 if(month<=2) 32 if(judge(year)) 33 count++; 34 if(month>2) 35 if(judge(year+18)) 36 count++; 37 printf("%d\n",count); 38 } 39 return 0; 40 }
标签:
原文地址:http://www.cnblogs.com/homura/p/4674210.html