package util;import java.awt.Rectangle;import java.awt.image.BufferedImage;import java.io.File;import java.io.FileInputStream;import java.io.InputStre...
分类:
编程语言 时间:
2014-09-25 17:49:57
阅读次数:
213
Problem Description
We use Red, Green and Blue to make new colours. See the picture below:
Now give you n rectangles, the colour of them is red or green or blue. You have calculate the area ...
分类:
其他好文 时间:
2014-09-25 10:46:38
阅读次数:
211
Chapter 15 Introduction to Auto Layout1. You do not define a view’s alignment rectangle directly. You do not have enough information (screen size!)to ...
分类:
其他好文 时间:
2014-09-24 21:38:47
阅读次数:
180
题意:
给出R,G,B三种颜色的矩形的数据,求最后7种颜色(R,G,B,RG,RB,GB,RGB)的面积是多少?
分析:
显然的线段树扫描线,可以说这题非常考验对线段树扫描线的理解,如果只会用模板,恐怕很难做出来。
R,G,B三种颜色最后会产生7种颜色(无色不算),可以预见本题对编码质量要求相当之高。
update()操作和一般的线段树扫描线并无太大的不同,本题的精髓在于query()!
一般的简单扫描线甚至不用写query,因为根结点维护的区间覆盖长度就是我们所需要的。但是本题需要从复杂的信息中分出7种信...
分类:
其他好文 时间:
2014-09-24 02:57:55
阅读次数:
213
题目大意:
给出多个不同颜色的矩形,求最后覆盖的颜色的面积。
思路分析:
我是自己手动暴力枚举。
比赛的时候漏了一种情况。
RGB 可以从 RG+RB组合来(只是举例,就是说可以从两种颜色组合而来)。
然后就只需要维护所有的颜色
用扫描线来判断。
#include
#include
#include
#include
#define MAXN 42222
u...
分类:
其他好文 时间:
2014-09-24 02:07:45
阅读次数:
209
rectangle-circle-intersect
分类:
其他好文 时间:
2014-09-23 18:46:25
阅读次数:
339
写一个程序,定义抽象基类Shape,由它派生出3个派生类,Circle(圆形)、Rectangle(矩形)、Triangle(三角形)。用如下的main()函数,求出定义的几个几何体的面积和
程序代码
#include
using namespace std;
class CSolid//立方体类
{
public:
//计算立方体的表面积
virtual d...
分类:
其他好文 时间:
2014-09-23 00:31:16
阅读次数:
370
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.难度:90 这是一道非常综合的题目,要求在0-1矩阵中找出面积最大...
分类:
其他好文 时间:
2014-09-22 07:45:22
阅读次数:
189
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist...
分类:
其他好文 时间:
2014-09-22 02:12:11
阅读次数:
245
题目:给你一些不同高度的宽度为1的木板,问能截取最大矩形面积。
分析:dp,单调队列。关键在于找到每个高度的最大连续长度,最大面积了 O(N*max(L),R));
如果暴力的话,则代价为O(N),则总代价为O(N*N)无法处理100000数据量;
但是可用单调队列,做预处理 用O(N)时间计算出所有点的边界,此时时间复杂度为 O(N);...
分类:
其他好文 时间:
2014-09-21 23:23:01
阅读次数:
247