题目大意
给出n个矩形的坐标,求全部矩形覆盖的面积
思路
离散一下就可以了把全部小矩形的面积加起来
O(n^2)
#include
#include
using namespace std;
struct arr
{
double x1,x2,y1,y2;
}a[1000];
int cam(double x,double y)
{
return xx1&&a[k].y2>y1)
{
ans+=(x2-x1)*(y2-y1);
break;
}
}
}
}
printf("Test case #%d\n",ll);
printf("Total explored area: %0.2lf\n\n",ans);
scanf("%d",&n);
}
}
Comments NOTHING