/*
Problem Description
给定一个日期,输出这个日期是该年的第几天。
Input
输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。
Output
对于每组输入数据,输出一行,表示该日期是该年的第几天。
Sample Input
1985/1/20
2006/3/12
Sample Output
20 71
*/
/*代码很垃圾,哈哈啊哈哈哈哈*/
#include<stdio.h>
int main()
{
int Year, Month, Day, days;
while(scanf("%d/%d/%d",&Year, &Month, &Day) != EOF)
{
if((Year%4==0&&Year%100!=0)||Year%400==0)//是闰年
{
switch(Month)
{
case 1:printf("%d\n",0+Day);break;
case 2:printf("%d\n",31+Day);break;//1月天数+日期
case 3:printf("%d\n",60+Day);break;//1月+2月+日期
case 4:printf("%d\n",91+Day);break;//1+2+3
case 5:printf("%d\n",121+Day);break;//1+2+3+4
case 6:printf("%d\n",152+Day);break;//1+2+3+4+5
case 7:printf("%d\n",182+Day);break;//182
case 8:printf("%d\n",213+Day);break;//213
case 9:printf("%d\n",244+Day);break;//244
case 10:printf("%d\n",274+Day);break;//274
case 11:printf("%d\n",305+Day);break;// 305
case 12:printf("%d\n",335+Day);break;//336
}
}
else
{
switch(Month)
{
case 1:printf("%d\n",0+Day);break;
case 2:printf("%d\n",31+Day);break;//1月天数+日期
case 3:printf("%d\n",59+Day);break;//1月+2月+日期
case 4:printf("%d\n",90+Day);break;//1+2+3
case 5:printf("%d\n",120+Day);break;//1+2+3+4
case 6:printf("%d\n",151+Day);break;//1+2+3+4+5
case 7:printf("%d\n",181+Day);break;//182
case 8:printf("%d\n",212+Day);break;//213
case 9:printf("%d\n",243+Day);break;//244
case 10:printf("%d\n",273+Day);break;//274
case 11:printf("%d\n",304+Day);break;// 305
case 12:printf("%d\n",334+Day);break;//336
}
}
}
return 0;
}