P - Atlantis - hdu1542(求面积)】的更多相关文章

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…
题意:rt 求面积......不计算重复面积(废话..)hdu1255 的弱化版,应该先做这道题在做那道题的. ************************************************************ #include<stdio.h> #include<algorithm> #include<math.h> ; ;} }a[MAXN<<]; ;     ))         a[r].len = ;     ;     ; …
 描述 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 ha…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1255 题目大意:给你若干个矩形,让你求这些矩形重叠两次及以上的部分的面积. 解题思路:模板题,跟HDU 1542  Atlantis一样是求面积并,唯一的差别是这题要求的是重叠两次以上的面积,只要将cnt>0的条件改为cnt>1即可. 代码: #include<cstdio> #include<cmath> #include<cstring> #include&…
HDU 1542 Atlantis 题目链接 题意:给定一些矩形,求面积并 思路:利用扫描线,因为这题矩形个数不多,直接暴力扫就能够了.假设数据大.就要用线段树 代码: #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const int N = 205; const int M = 100005; const dou…
链接: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…
取出纵向边按x坐标排序,在y方向上建立线段树. 每次查询当前有效长度len,ans += len*(x[i]-x[i-1]); 其中len为T[rt].len; 查询完毕后更新y方向上线段树,入边+1, 出边-1. #include<bits/stdc++.h> using namespace std; #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 typedef long long ll; struct L…
class Rectangle { private double len, wid; public Rectangle()//求矩形周长 { len = 0; wid = 0; } public Rectangle(int l, int w)//求矩形面积 { len = l; wid = w; } public double perimeter()//求周长 { return ((len + wid) * 2); } public double area()//求面积 { return (le…
https://cn.vjudge.net/problem/HDU-1255 题意 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. 分析 求面积并的题:https://www.cnblogs.com/fht-litost/p/9580330.html 这题求面积交,也就是cover>=2才计算,采用第一种方法就只用小小改动. 以下用了第二种方法.这里得维护覆盖一次以上的长度,和覆盖两次以上的长度.重点在cal()函数. #include <iostream> #inclu…
题意: 就是扫描线求面积交 解析: 参考求面积并.... 就是把down的判断条件改了一下..由w > 0 改为 w > 1 同时要讨论一下 == 1 时  的情况, 所以就要用到一个临时的sum.. 具体看代码把 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set>…