c++:
#include <iostream>
using namespace std;
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int year,month,day; char t;
while(cin>>year>>t>>month>>t>>day){
for(int i=1;i<month;i++)
day+=mon[i];
if(month>2&&((year%4==0&&year%100!=0)||year%400==0))
day+=1;
cout<<day<<endl;
}
return 0;
}
c:
#include <stdio.h>
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int year,month,day,i;
while(scanf("%d/%d/%d",&year,&month,&day)!=EOF){
//getchar(); 有无均可
for(i=1;i<month;i++)
day+=mon[i];
if(month>2&&((year%4==0&&year%100!=0)||year%400==0))
day+=1;
printf("%d\n",day);
}
return 0;
}