题目传送门

 /*
题意:求最大矩形(全0)的面积
暴力/dp:每对一个0查看它左下的最大矩形面积,更新ans
注意:是字符串,没用空格,好事多磨,WA了多少次才发现:(
详细解释:http://www.cnblogs.com/cszlg/p/3217478.html
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; const int MAXN = ;
const int INF = 0x3f3f3f3f;
char s[MAXN][MAXN];
int n, m; int get_sum(int x, int y)
{
int res = ; int d, w = ;
for (int i=x; i<n; ++i)
{
if (s[i][y] == '') break;
int j = y + ;
while (j < m && s[i][j] == '') ++j;
d = i - x + ;
if (w > j - y) w = j - y;
res = max (res, (w + d) * );
} return res;
} int main(void) //Codeforces Beta Round #22 (Div. 2 Only) B. Bargaining Table
{
while (scanf ("%d%d", &n, &m) == )
{
for (int i=; i<n; ++i)
{
scanf ("%s", s[i]);
} int ans = ;
for (int i=; i<n; ++i)
{
for (int j=; j<m; ++j)
{
if (s[i][j] == '')
{
ans = max (ans, get_sum (i, j));
}
}
} printf ("%d\n", ans);
} return ;
}

暴力/DP Codeforces Beta Round #22 (Div. 2 Only) B. Bargaining Table的更多相关文章

  1. Codeforces Beta Round #22 (Div. 2 Only)

    Codeforces Beta Round #22 (Div. 2 Only) http://codeforces.com/contest/22 A 水题 #include<bits/stdc+ ...

  2. Codeforces Beta Round #22 (Div. 2 Only) E. Scheme dfs贪心

    E. Scheme   To learn as soon as possible the latest news about their favourite fundamentally new ope ...

  3. 图论/暴力 Codeforces Beta Round #94 (Div. 2 Only) B. Students and Shoelaces

    题目传送门 /* 图论/暴力:这是个连通的问题,每一次把所有度数为1的砍掉,把连接的点再砍掉,总之很神奇,不懂:) */ #include <cstdio> #include <cs ...

  4. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  5. Codeforces Beta Round #59 (Div. 2)

    Codeforces Beta Round #59 (Div. 2) http://codeforces.com/contest/63 A #include<bits/stdc++.h> ...

  6. Codeforces Beta Round #31 (Div. 2, Codeforces format)

    Codeforces Beta Round #31 (Div. 2, Codeforces format) http://codeforces.com/contest/31 A #include< ...

  7. Codeforces Beta Round #18 (Div. 2 Only)

    Codeforces Beta Round #18 (Div. 2 Only) http://codeforces.com/contest/18 A 暴力 #include<bits/stdc+ ...

  8. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  9. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

随机推荐

  1. chapter1:using neural nets to recognize handwritten digits

    two important types of artificial neuron :the perceptron and the sigmoid neuron Perceptrons 感知机的输入个数 ...

  2. POJ3262 Protecting the Flowers 【贪心】

    Protecting the Flowers Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4418   Accepted: ...

  3. Office EXCEL 如何保留一位小数,并且单击这个单元格的时候没有一大串小数

    左侧有一列数据,即便我设置单元格格式,把小数位数设为1,看上去的确四舍五入,保留一位小数了,但是实际上我鼠标双击任意单元格,还是原来的数值,这样的数据如果是要发给别人的,肯定不好   如果进行选择性粘 ...

  4. python爬虫(二)--了解deque

    队列-deque 有了上面一节的基础.当然你须要全然掌握上一节的全部方法,由于上一节的方法.在以下的教程中 会重复的用到. 假设你没有记住,请你返回上一节. http://blog.csdn.net/ ...

  5. boost的内存管理

    smart_ptr raii ( Resource Acquisition Is Initialization ) 智能指针系列的都统称为smart_ptr.包含c++98标准的auto_ptr 智能 ...

  6. 他人第三方库在linux上的安装

    1.下载tar.gz等压缩包 2.解压 3.安装 4.确保路径

  7. web框架和Django框架的初识

    1,web框架的原理 1.1>c/s架构和b/s架构 1>c/s客户端模式 2>B/S浏览器模式-----web开发(web开发开的是B/S架构) 1.2>web开发的本质 1 ...

  8. MTK 电池曲线配置【转】

    本文转载自:http://blog.csdn.net/u010245383/article/details/51006597 硬件平台:MT8382 网上有很多关于电池曲线配置的文档,定位到具体的文件 ...

  9. UVA11419 SAM I AM —— 最小点覆盖 + 输出覆盖点集

    题目链接:https://vjudge.net/problem/UVA-11419 题解: 1.二分图匹配之最小点覆盖.:把x坐标和y坐标看成是点, 图中的目标看成是边,所以最终的目的是求出用最少的点 ...

  10. HDU2121 Ice_cream’s world II —— 最小树形图 + 不定根 + 超级点

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2121 Ice_cream’s world II Time Limit: 3000/1000 MS (J ...