#include<stdio.h>
int main()
{
int year,mouth,day,count;
while(~scanf("%d/%d/%d",&year,&mouth,&day)){
count=0;
switch(mouth-1){
case 11:count+=30;
case 10:count+=31;
case 9:count+=30;
case 8:count+=31;
case 7:count+=31;
case 6:count+=30;
case 5:count+=31;
case 4:count+=30;
case 3:count+=31;
case 2:if((year%4==0&&year%100!=0)||(year%400==0))
count+=29;
else
count+=28;
case 1:count+=31;
}
count+=day;
printf("%d\n",count);
}
return 0;
}
第几天?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 77680 Accepted Submission(s): 29265
Problem Description
给定一个日期,输出这个日期是该年的第几天。
Input
输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。
Output
对于每组输入数据,输出一行,表示该日期是该年的第几天。
Sample Input
1985/1/20 2006/3/12
Sample Output
20 71
Author
lcy