#include<stdio.h> int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int isLeapYear(int Y){ if(Y%4==0&&Y%100!=0||Y%400==0) return 1; else return 0; } int Y,M,D; void solve() { int sum=0; for(int i=1;i<=M-1;++i){ sum+=month[i]; } sum+=D; printf("%d\n",sum); } int main(int argc, char *argv[]) { // freopen("1070.in", "r", stdin); while(~scanf("%d%d%d",&Y,&M,&D)) { if(isLeapYear(Y)){ month[2]+=1; solve(); month[2]-=1; } else solve(); } return 0; } /************************************************************** Problem: 1070 User: kirchhoff Language: C Result: Accepted Time:10 ms Memory:912 kb ****************************************************************/
原文地址:http://blog.csdn.net/wdkirchhoff/article/details/41928087