View Code
1 #include<stdio.h> 2 int main() 3 { 4 int m,y,d,sum; 5 scanf("%d%d%d",&y,&m,&d); 6 if((y%4==0&&y%100!=0)||(y%400==0))//闰年 7 { 8 if(m==1) 9 sum=d; 10 else 11 if(m==2) 12 sum=31+d; 13 else 14 if(m==3) 15 sum=31+29+d; 16 else 17 if(m==4) 18 sum=31+29+31+d; 19 else 20 if(m==5) 21 sum=31+29+31+30+d; 22 else 23 if(m==6) 24 sum=31+29+31+30+31+d; 25 else 26 if(m==7) 27 sum=31+29+31+30+31+30+d; 28 else 29 if(m==8) 30 sum=31+29+31+30+31+30+31+d; 31 else 32 if(m==9) 33 sum=31+29+31+30+31+30+31+31+d; 34 else 35 if(m==10) 36 sum=31+29+31+30+31+30+31+31+30+d; 37 else 38 if(m==11) 39 sum=31+29+31+30+31+30+31+31+30+31+d; 40 else 41 if(m==12) 42 sum=31+29+31+30+31+30+31+31+30+31+30+d; 43 } 44 else 45 { 46 if(m==1) 47 sum=d; 48 else 49 if(m==2) 50 sum=31+d; 51 else 52 if(m==3) 53 sum=31+28+d; 54 else 55 if(m==4) 56 sum=31+28+31+d; 57 else 58 if(m==5) 59 sum=31+28+31+30+d; 60 else 61 if(m==6) 62 sum=31+28+31+30+31+d; 63 else 64 if(m==7) 65 sum=31+28+31+30+31+30+d; 66 else 67 if(m==8) 68 sum=31+28+31+30+31+30+31+d; 69 else 70 if(m==9) 71 sum=31+28+31+30+31+30+31+31+d; 72 else 73 if(m==10) 74 sum=31+28+31+30+31+30+31+31+30+d; 75 else 76 if(m==11) 77 sum=31+28+31+30+31+30+31+31+30+31+d; 78 else 79 if(m==12) 80 sum=31+28+31+30+31+30+31+31+30+31+30+d; 81 } 82 printf("%d\n",sum); 83 return 0; 84 }