http://acm.hdu.edu.cn/showproblem.php?pid=2005
#include <stdio.h>
int main(){
int year,month,day,i,num=0;
int d[12]={31,28,31,30,31,30,31,31,30,31,30,31};
while(scanf("%d/%d/%d",&year,&month,&day)!=EOF){
if(year%4==0&&year%100!=0||year%400==0)
d[1]=29;
else d[1]=28;
for(i=0;i<month-1;i++){
num+=d[i];
}
num+=day;
printf("%d\n",num);
num=0;
}
return 0;
}
闰年的定义:①可以被4整除但不能被100整除;②可以400整除
注意输入格式