#include<stdio.h> int days[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int judge(int a); int main() { int a,b,c,i,sum=0; while(scanf("%d/%d/%d",&a,&b,&c)==3) { sum=0; for(i=0;i<b-1;i++) { sum+=days[i]; if(judge(a) &&i==1) sum+=1; } sum+=c; printf("%d\n",sum); } return 0; } int judge(int a) { if((a%4==0 && a%100) ||(a%100==0&&a%400==0)) return 1; else return 0; }
时间: 2024-10-01 03:40:06