Run ID:158698

提交时间:2026-08-22 16:45:10

#include<bits/stdc++.h> using namespace std; bool r(int y){ if((y%4==0 && y%100!=0) || y%400==0){ return 1; } return 0; } int main(){ int T; cin>>T; while(T--){ int a,b,c; char f; cin>>a>>f>>b>>f>>c; if(!r(a+18) && b==2 && c==29){ cout<<-1<<endl; continue; } int d=0; for(int i=a;i<a+18;i++){ if(b<=2){ if(r(i)){ d+=366; } else{ d+=365; } } else{ if(r(i+1)){ d+=366; } else{ d+=365; } } } cout<<d<<endl; } return 0; }