水题。好久没有写过优化搜索题了。

 #include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
char str[][];
int r[][];
int c[][];
int judge(int rx,int ry,int lx,int ly)
{
int i,j;
for(i = lx;i <= rx;i ++)
{
for(j = ly;j <= ry;j ++)
{
if(str[i-][j-] == '')
return ;
}
}
return ;
}
int main()
{
int n,m,i,j,k,u,ans;
scanf("%d%d",&n,&m);
for(i = ;i < n;i ++)
scanf("%s",str[i]);
ans = ;
for(i = ;i <= n;i ++)
{
for(j = ;j <= m;j ++)
{
if(str[i-][j-] == '')
{
r[i][j] = r[i-][j] + ;
c[i][j] = c[i][j-] + ;
}
else
{
r[i][j] = ;
c[i][j] = ;
}
}
}
for(i = n;i >= ;i --)
{
for(j = m;j >= ;j --)
{
for(k = ;k <= r[i][j];k ++)
{
for(u = ;u <= c[i][j];u ++)
{
if(ans >= (k+u)*) continue;
if(judge(i,j,i-k+,j-u+))
{
ans = max(ans,(k+u)*);
}
}
}
}
}
printf("%d\n",ans);
return ;
}

CF 22B. Bargaining Table的更多相关文章

  1. Code Forces 22B Bargaining Table

    B. Bargaining Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. Codeforces 22B Bargaining Table

    http://www.codeforces.com/problemset/problem/22/B 题意:求出n*m的方格图中全是0的矩阵的最大周长 思路:枚举 #include<cstdio& ...

  3. CodeForces 22B Bargaining Table 简单DP

    题目很好理解,问你的是在所给的图中周长最长的矩形是多长嗯用坐标(x1, y1, x2, y2)表示一个矩形,暴力图中所有矩形易得递推式:(x1, y1, x2, y2)为矩形的充要条件为: (x1, ...

  4. Bargaining Table

    Bargaining Table time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  5. 暴力/DP Codeforces Beta Round #22 (Div. 2 Only) B. Bargaining Table

    题目传送门 /* 题意:求最大矩形(全0)的面积 暴力/dp:每对一个0查看它左下的最大矩形面积,更新ans 注意:是字符串,没用空格,好事多磨,WA了多少次才发现:( 详细解释:http://www ...

  6. CF 71C. Round Table Knights

    题目链接 很多小的细节都没想到... #include <cstdio> #include <cstring> #include <iostream> #inclu ...

  7. CF#338D. GCD Table

    传送门 简单的中国剩余定理练习. 首先行数一定是$lcm$,然后只要确定最小的列数就能判定解合不合法了. 我们可以得到线性模方程组: $y \equiv 0 \pmod{a_1}$ $y+1 \equ ...

  8. CF 662C Binary Table

    用FWT优化计算. 首先发现行数很小,想到一个暴力的方法,就是以一个二进制位$0$表示这一行不翻转而二进制位$1$表示这一行翻转,然后$2^n$枚举出所有行的翻转情况,再$O(m)$计算所有的结果. ...

  9. CF dp 题(1500-2000难度)

    前言 从后往前刷 update 新增 \(\text{\color{red}{Mark}}\) 标记功能,有一定难度的题标记为 \(\text{\color{red}{红}}\) 色. 题单 (刷过的 ...

随机推荐

  1. java的final用法

    转自:http://blog.163.com/maomaoyu_1012/blog/static/19060130520116269329894/ 1.         修饰基础数据成员的final ...

  2. HTML5学习之画布和SVG(四)

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  3. 编程风格规范google版

    python's  coding style,google 命名

  4. 【Java EE 学习 21 下】【使用java实现邮件发送、邮件验证】

    一.邮件发送 1.邮件发送使用SMTP协议或者IMAP协议,这里使用SMTP协议演示. SMTP协议使用的端口号:25 rfc821详细记载了该协议的相关信息 (1)使用telnet发送邮件(使用12 ...

  5. 攻城狮在路上(叁)Linux(十六)--- 命令与文件的查找

    一.脚本文件的查询: 1.命令格式:which [-a] command; <==通过PATH来查找. -a:列出所有的,而不是仅列出第一个. 示例: which ifconfig; 注意:由于 ...

  6. wpf template的code写法

    this.Template = XamlReader.Load ("<ControlTemplate xmlns='http://schemas.microsoft.com/clien ...

  7. 【hibernate】 hibernate的主键策略

    今天使用maven生成一个sping+springMVC+hibernate 的项目,报错如下: 错误提示呢:不能解释这个id的生成策略[uuid.string].就是uuid.string这个hib ...

  8. python装饰器--@property

    @property 考察 Student 类: class Student(object): def __init__(self, name, score): self.name = name sel ...

  9. 安装Maven、Eclipse设置、添加地址JAR

    1.下载Maven 地址:http://maven.apache.org/download.cgi 2.安装Maven 系统变量:MAVEN_HOME = D:\maven\apache-maven- ...

  10. C# 生成随机数

    private static char[] constant = { ', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p ...