352.#include<iostream>
353.using namespace std;
354.int main()
355.{int year(int);
356.int month(int);
357.int fun(int,int,int);
358.int m,n,k,i,sum=0;
359.cout<<"输入年月日(如:year-month-day):";
360.cin>>m>>n>>k;
361.if(fun(m,n,k)==0)
362.{cout<<"输入错误,请重输:";
363.cin>>m>>n>>k;
364.}
365.else
366.{for(i=1;i<=n;i++)
367.sum=sum+month(n);
368.sum=sum+k;
369.cout<<"第"<<sum<<"天"<<endl;
370.}
371.return 0;
372.}
373.int month(int x)
374.{int j;
375.int year(int);
376.if(year(j)==1)
377.{if(x==4||x==9||x==6||x==11)
378.return 30;
379.else if(x==2)
380.return 29;
381.else
382.return 31;
383.}
384.else
385.{if(x==4||x==9||x==6||x==11)
386.return 30;
387.else if(x==2)
388.return 28;
389.else
390.return 31;
391.}
392.}
393.int fun(int a,int b,int c)
394.{int year(int);
395.if(a<=0||b<=0||b>12||c<=0||c>31)
396.return 0;
397.else
398.{if(b==4||b==6||b==9||b==11)
399.{if(c<=30)
400.return 1;
401.else
402.return 0;
403.}
404.if(b==2&&(year(a)==1))
405.{if(b<=29)
406.return 1;
407.else
408.return 0;
409.}
410.if(b==2&&(year(a)!=1))
411.{if(b<=28)
412.return 1;
413.else
414.return 0;
415.}
416.if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)
417.return 1;
418.}
419.}
420.int year(int x)
421.{if((x%4==0&&x%100!=0)||(x%400==0))
422.return 1;
423.else
424.return 0;
423.}