#include <iostream> //输入年月日计算是第几天 bool IsLeapYear(int year){ return ((year%4==0&&year%100!=0)||year%400==0); } int dayTab[2][13]={ {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,30,31} }; int main() { int year,month,day; int row;//如果是闰年,IsLeapYear函数结果是1,若不是为0 while(scanf("%d %d %d",&year,&month,&day)!=EOF){ row= IsLeapYear(year); int sum=0; for(int i=0;i<month;i++){ sum+=dayTab[row][i]; } sum=sum+day; printf("%d\n",sum); } return 0; }