题目链接:​​http://acm.hdu.edu.cn/showproblem.php?pid=2005​​​
水题,直接看代码:

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define endl "\n"
#define PI 3.1415927
using namespace std;

int main(){
int a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int year,month,day;
while(scanf("%d/%d/%d",&year,&month,&day)!=EOF){
int sum=0;
if(year%4==0&&year%100!=0||year%400==0){
for(int i=0;i<month-1;i++){
sum+=a[i];

}
sum+=day;
}
else{
for(int i=0;i<month-1;i++){
sum+=b[i];

}
sum+=day;
}
printf("%d\n",sum);
}
return 0;

}