#include<iostream> #include<cmath> #include<cstring> #include<algorithm> #include<vector> using namespace std; int main() { int t; cin>>t; while(t--){ int a,b,c,d; int a2,b2,c2,d2; cin>>a>>b>>c>>d; cin>>a2>>b2>>c2>>d2; double n1=(double)(b-d)/(a-c); double n2=(double)(b2-d2)/(a2-c2); if(n1>0||n2<0) printf("0.00\n"); else { double h=b>d2?b:d2; double m1=c2-a; double m2=a2-c; printf("%.2f\n",h*(m1+m2)/2); } } return 0; } |
Double click to view unformatted code.