/* 两个日期之间相隔的天数 */ #include<stdio.h> int y1,y2,m1,m2,d1,d2; int tian[2][13]={0,31,28,31,30,31,30,31,31,30,31,30,31,0,31,29,31,30,31,30,31,31,30,31,30,31}; int from(int n,int y,int t) { int f,ret=t,i=y-1; if(n%400==0||n%4==0&&n%100!=0) f=1; else f=0; while(i>0) { ret+=tian[f][i]; i--; } return ret; } int solve() { int q1=from(y1,m1,d1),q2=from(y2,m2,d2); int ret=0,s=y1; while(s!=y2) { if(s%400==0||s%4==0&&s%100!=0) ret+=366; else ret+=365; s++; } return ret+q2-q1; } int main() { int n; scanf("%d",&n); while(n--) { scanf("%d%d%d",&y1,&m1,&d1); scanf("%d%d",&m2,&d2); y2=2012; printf("%d\n",solve()+1);//没注意当天还算 } return 0; }