Tsinsen-A1042-矩阵面积交
2017-01-08 11:52
225 查看
#include <cstdio> #include <iostream> #include <iomanip> using namespace std; int main() { double x1, x2, x3, x4, y1, y2, y3, y4; cin >> x1 >> y1 >> x2 >> y2; cin >> x3 >> y3 >> x4 >> y4; if (x1 > x2) swap(x1, x2);//保证下标1保存左下角的点 if (y1 > y2) swap(y1, y2); if (x3 > x4) swap(x3, x4); if (y3 > y4) swap(y3, y4); double x = min(x2, x4) - max(x1, x3); x = x < 0 ? 0.0 : x; double y = min(y2, y4) - max(y1, y3); y = y < 0 ? 0.0 : y; //精度两位 cout.precision(2); cout << fixed << x*y << endl; }
2017.1.8
相关文章推荐
- BASIC-18 / Tsinsen 1042 矩阵面积交(java)
- HDU 2870 Largest Submatrix(最大子矩阵面积)
- POJ 1151 Atlantis(重叠矩阵面积和=离散化)
- 线段树 扫描线求矩阵面积并的模板(zz)
- 求最小面积外接矩阵和最小周长外接矩阵
- HDU 1505 City Game【矩阵的最大面积】
- 对称矩阵面积计算
- POJ 1151 Atlantis 求矩阵面积并 扫描线 具体解释
- 一个N*M的矩阵,找出这个矩阵中所有元素的和不小于K的面积最小的子矩阵
- 翻转数字、大小写转换、斐波那契、整数排序、链表删除、矩阵面积【Python】
- 九度OJ 1102 最小面积子矩阵 (+最短连续子序列)
- 题目1497:面积最大的全1子矩阵
- 动态规划4:最大子段和问题到最大子矩阵问题(四):最大子矩阵面积问题
- hdu1542 矩阵面积并+线段树+离散化+二分+扫描线
- 面积最大的全1子矩阵--九度OJ 1497
- 面积最大的全1子矩阵
- FZU 2187 回家种地 ( 扫描线 + 离散 求矩阵单次覆盖面积 )
- 【BZOJ】【2738】&【Tsinsen】【A1333】矩阵乘法
- 线段树+扫描线求矩阵面积并
- LintCode-[入门] 454. 矩阵面积