由题意得:
1.感觉很简单……
2.需要按格式输入年月日
3.每输入一行就输出一行
4.代码如下:
#include<stdio.h>
int main()
{
int year,month,day,sum;
while(~scanf("%d/%d/%d",&year,&month,&day))
{
sum=day;
switch(month-1)
{
case 11: sum+=30;
case 10: sum+=31;
case 9: sum+=30;
case 8: sum+=31;
case 7: sum+=31;
case 6: sum+=30;
case 5: sum+=31;
case 4: sum+=30;
case 3: sum+=31;
case 2: if((year%4==0&&year%100!=0)||(year%400==0) sum+=29;
else sum+=28;
case 1:sum+=31;
}
printf("%d\n",sum);
}
return 0;
}