标签:des style java color os strong
1 1988-03-07
6574
#include<stdio.h> int leap(int Y) { if(Y%4==0&&Y%100!=0||Y%400==0) return 1; else return 0; } int main() { int i,T; int Y,M,D; int Date; scanf("%d",&T); while(T--) { Date=18*365; scanf("%d-%d-%d",&Y,&M,&D); if(!leap(Y+18)&&M==2&&D==29) { printf("-1\n");continue; } if(leap(Y)&&(M<2||M==2)&&D<=28) Date++;//此处有逻辑问题,不加括号会出现错误 //if(leap(Y)&&M==2&&D==29&&leap(Y+18)) Date++; //if(M>2&&leap(Y+18)) Date++; if(leap(Y+18)&&M>2||M==2&&D==29) Date++; for(i=Y+1;i<=Y+17;i++) { if(leap(i)) Date++; } printf("%d\n",Date); } return 0; }
标签:des style java color os strong
原文地址:http://blog.csdn.net/qq_16767427/article/details/38058731