标签:hdu
1.00 1.00 3.00 3.00 2.00 2.00 4.00 4.00 5.00 5.00 13.00 13.00 4.00 4.00 12.50 12.50
1.00 56.25
#include <iostream> #include <algorithm> #include <stdio.h> #include <cmath> using namespace std; int main() { double x[4], y[4], x1, x2, y1, y2, s; while (cin >> x[0]>> y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]) { x1 = fabs(x[1] - x[0]); x2 = fabs(x[3] - x[2]); y1 = fabs(y[1] - y[0]); y2 = fabs(y[3] - y[2]); sort(x,x+4); sort(y,y+4); if ( (x[3]-x[0]) < x1+x2 && (y[3]-y[0]) < y1+y2) { s = ( x[2] -x[1]) * (y[2] - y[1]); printf("%.2lf\n",s); } else cout << "0.00"<< endl; } return 0; }
标签:hdu
原文地址:http://blog.csdn.net/xiaotan1314/article/details/46454571