Run ID:137638

提交时间:2025-11-21 19:45:33

#include <bits/stdc++.h> using namespace std; int main() { int c,d,i,j,k,t,temp,b[12]={31,28,31,30,31,30,31,31,30,31,30,31}; string a; cin>>t; getline(cin,a); while (t--) { s=0; getline(cin,a); i=(a[0]-'0')*1000+(a[1]-'0')*100+(a[2]-'0')*10+(a[3]-'0'); j=(a[5]-'0')*10+a[6]-'0'; k=(a[8]-'0')*10+a[9]-'0'; c=j; d=k; if (i%400==0 and i%100==0 or i%4==0 and i%100!=0) b[1]=29; else b[1]=28; j=j-1; s=s+b[j]-k+1; while (j+1<12) { s=s+b[j+1]; j++; } n=1; i=i+1; while (n<=18) { if (i%400==0 and i%100==0 or i%4==0 and i%100!=0) { temp=1; b[1]=29; } else { temp=0; b[1]=28; } j=0; while (j<12) { s=s+b[j]; j++; } i++; n++; } if (temp!=0) { if (c==2 and d==b[1]) cout<<s<<endl;; else if (c==2 and d!=b[1]) cout<<-1<<endl;; } } }