因为前面有很多我觉得很简单的所以这个就直接从这个开始了。如果这个博客上面没有的例子一定是我没写
1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int Test(int year,int month,int day) 5 { 6 static int d[2][12] = {0,31,59,90,120,151,181,212,243,273,304,334, 7 0,31,60,91,121,152,182,213,244,274,305,335 8 }; 9 10 if(year%4 == 0)year = 1; 11 else year = 0; 12 return d[year][month-1]+day; 13 } 14 15 int main() 16 { 17 int year,month,day; 18 while(~scanf("%d %d %d",&year,&month,&day)) 19 { 20 printf("%d ",Test(year,month,day)); 21 } 22 return 0; 23 }