标签:
#include<cstring> #include<iostream> #include<cstdio> #include<cmath> using namespace std; int main() { int z; int a,b,c; cin>>z; while(z--) { scanf("%d-%d-%d",&a,&b,&c); bool bl = 1; if(b == 1||(b == 2&&c<=29)) bl = 0; int num = 18*365; int i; if(bl) { for(i = a+1;i<=a+18;i++) { if(i%400 == 0||(i%4 == 0&&i%100!=0)) num++; } } if(!bl) { for(i = a;i<a+18;i++) { if(i%400 == 0||(i%4 == 0&&i%100!=0)) num++; } } if(b = 2&&c == 29) { puts("-1"); continue; } printf("%d\n",num); } return 0; }
标签:
原文地址:http://www.cnblogs.com/wos1239/p/4581637.html