杭电2005----第几天?
1 #include<stdio.h> 2 int main() 3 { 4 int y,m,d; 5 while(~scanf("%d/%d/%d",&y,&m,&d)) 6 { 7 switch(m) 8 { 9 case 2:d+=31;break; 10 case 3:d+=59;break; 11 case 4:d+=90;break; 12 case 5:d+=120;break; 13 case 6:d+=151;break; 14 case 7:d+=181;break; 15 case 8:d+=212;break; 16 case 9:d+=243;break; 17 case 10:d+=273;break; 18 case 11:d+=304;break; 19 case 12:d+=334;break; 20 } 21 if((m>2&&y%4==0&&y%100!=0)||y%400==0&&m>2) 22 d++; 23 printf("%d\n",d); 24 } 25 return 0; 26 }