2012年11月26日

摘要: 题意很简单,就是求n个矩形的周长并。方法跟求面积并差不多,只是在扫描矩形上下边时需要统计竖直边的个数,先排个序,每次更新求出变化的和。View Code 1 #include <stdio.h> 2 #include <math.h> 3 #define lson l,m,rt<<1 4 #define rson m+1,r,rt<<1|1 5 #define maxn 20005 6 struct node 7 { 8 int len,lnum,rnum,cnt,segnum; 9 }setree[maxn<<2]; 10 stru 阅读全文
posted @ 2012-11-26 22:04 kim888168 阅读(131) 评论(0) 推荐(0) 编辑
 
摘要: 题意:给出n个矩形的左下坐标和右上坐标,求出总面积。在写pushup函数时,没有考虑l==r的情况,wa了很久。看了其他大牛的解题报告才想起来的。╭(╯^╰)╮View Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 #define maxn 205 7 struct node 8 { 9 double len; 10 int cnt; 11 阅读全文
posted @ 2012-11-26 11:15 kim888168 阅读(127) 评论(0) 推荐(0) 编辑