题目Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing all ones and return its area.思路对于上图的一个01矩阵。我们可以一行一行的分析,假设第三行,我们按列扫描,遇到0时,柱子断开,重新形成柱子,遇到1时柱子高度加一。这样的话,我们就可以把问题转换...
分类:
其他好文 时间:
2015-05-14 22:05:23
阅读次数:
137
Again Prime? No time.
Input: standard input
Output: standard output
Time Limit: 1 second
The problem statement is very easy. Given a number n you have to determine the largest power of m, not ne...
分类:
其他好文 时间:
2015-05-14 20:37:11
阅读次数:
118
题目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 histogram.Above is a histogram where width of each ba...
分类:
其他好文 时间:
2015-05-13 19:52:46
阅读次数:
125
题目:Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the his...
分类:
其他好文 时间:
2015-05-13 10:09:33
阅读次数:
156
题目A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.Find the larges...
分类:
其他好文 时间:
2015-05-13 00:51:35
阅读次数:
228
1.ans=max(全为a的最大矩阵,全为b的最大矩阵,全为c的最大矩阵)
2.代码:
#include
#include
#include
using namespace std;
const int INF=1<<30;
char mat[1005][1005];
int a[1005][1005];
int b[1005][1005];
int c[1005][1005];
int L...
分类:
其他好文 时间:
2015-05-12 09:30:36
阅读次数:
134
Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog...
分类:
其他好文 时间:
2015-05-09 01:13:01
阅读次数:
169
Problem Description
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figur...
分类:
其他好文 时间:
2015-05-07 22:16:16
阅读次数:
143
1.注意要把a[]定义为LL,我在这里wa了N次
2.寻找边界时,得用dp思想
AC代码:#include
#include
#define LL long long
using namespace std;
const LL INF=1<<60;
LL a[100005];//要定义为LL
int L[100005];
int R[100005];
int main()
{
in...
分类:
其他好文 时间:
2015-05-07 00:55:21
阅读次数:
108
DescriptionGiven a 2-dimensional array of positive and negative integers, find the sub-rectangle with the largest sum. The sum of a rectangle is the s...
分类:
其他好文 时间:
2015-05-06 22:28:44
阅读次数:
144