题意: 就是扫描线求面积交 解析: 参考求面积并.... 就是把down的判断条件改了一下..由w > 0 改为 w > 1 同时要讨论一下 == 1 时  的情况, 所以就要用到一个临时的sum.. 具体看代码把 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set>…
题意:      给定n个矩形的对角坐标,分别是左下和右上,浮点型,求矩形覆盖的面积. 思路:       基本的线段树扫描线求面积,没有坑点,不解释了,提示一点,有的题尤其是线段树扫描线的题需要离散化的时候建议二分去找,别map,记得之前map超时过很多次,但不是针对这个题目,这个题数据量不大,怎么都行,发现codeblock这个编译器定义宏然后在定义结构体的时候变量名字相同导致编译不过去,我之前用的DEV也是这么写的,记得能编译过去,不知道为啥. #include<stdio.h> #in…
扫描线求周长,可以看成两条线,一条扫x轴,一条扫y轴,然后这两天线扫过去的 周长加起来,就是周长了 #include<map> #include<set> #include<ctime> #include<cmath> #include<stack> #include<queue> #include<string> #include<vector> #include<cstdio> #include…
链接:http://poj.org/problem?id=3348 Cows Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6677   Accepted: 3020 Description Your friend to the south is interested in building fences and turning plowshares into swords. In order to help with…
There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe different regions of Atlantis. Your friend Bill has to…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1255 题目大意:给你若干个矩形,让你求这些矩形重叠两次及以上的部分的面积. 解题思路:模板题,跟HDU 1542  Atlantis一样是求面积并,唯一的差别是这题要求的是重叠两次以上的面积,只要将cnt>0的条件改为cnt>1即可. 代码: #include<cstdio> #include<cmath> #include<cstring> #include&…
题意:求矩形并的面积.. 解析: 扫描线第一道题....自下而上扫描的... 如果不懂什么是扫描线戳我 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include <stack> #include <q…
题目链接:https://cn.vjudge.net/problem/POJ-1177 题目大意:求矩形外部的周长 具体思路:借用一下bin巨的一张图片. 我们按照y周从下往上的扫描线进行扫描,第一下,求出红色的部分的面积(x轴的长度+当前的y高度和上一个点的高度之差*2).第二次,我们计算x轴的长度是 上一次被覆盖的x轴的长度-当前的被x轴覆盖的面积,这样的话,就可以避免重复的计算了. AC代码: #include <iostream> #include <cstdio> #in…
题意:求周长的,把矩形先进行融合后的周长,包括内周长 分析:刚看的时候感觉会跟棘手,让人无从下手,不过学过扫描线之后相信就很简单了吧(扫描线的模板- -),还是不说了,下面是一精确图,可以拿来调试数据 ***************************************************************************************************************** #include<stdio.h> #include<math…
题目链接 Description A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partially or totally covered by the others. The length of the b…