暴力解。

  1. #include <cstdio>
  2. #include <cstring>
  3.  
  4. #define MAXN 105
  5.  
  6. char map[MAXN][MAXN];
  7. char visit[];
  8. int n, m;
  9.  
  10. bool check(char c) {
  11. int i, j;
  12. int x1=MAXN, y1=MAXN, x2=-, y2=-;
  13.  
  14. for (i=; i<n; ++i) {
  15. for (j=; j<m; ++j) {
  16. if (map[i][j] == c) {
  17. if (i<x1) x1 = i;
  18. if (j<y1) y1 = j;
  19. if (i>x2) x2 = i;
  20. if (j>y2) y2 = j;
  21. }
  22. }
  23. }
  24. if (x2-x1< || y2-y1<)
  25. return false;
  26. for (i=x1; i<=x2; ++i)
  27. if (map[i][y1]!=c || map[i][y2]!=c)
  28. return false;
  29. for (j=y1; j<=y2; ++j)
  30. if (map[x1][j]!=c || map[x2][j]!=c)
  31. return false;
  32. for (i=x1+; i<x2; ++i)
  33. for (j=y1+; j<y2; ++j)
  34. if (map[i][j] != '.')
  35. return false;
  36. return true;
  37. }
  38.  
  39. int main() {
  40. int i;
  41. int j;
  42.  
  43. while (scanf("%d %d", &n, &m)!=EOF && (n||m)) {
  44. memset(visit, false, sizeof(visit));
  45. for (i=; i<n; ++i) {
  46. scanf("%s", map[i]);
  47. for (j=; j<m; ++j) {
  48. if (map[i][j] != '.') {
  49. visit[map[i][j]-'A'] = true;
  50. }
  51. }
  52. }
  53. for (i=; i<; ++i) {
  54. if (visit[i] && check(i+'A'))
  55. printf("%c", i+'A');
  56. }
  57. printf("\n");
  58. }
  59.  
  60. return ;
  61. }

【HDOJ】2487 Ugly Windows的更多相关文章

  1. 【转】linux和windows下安装python集成开发环境及其python包

    本系列分为两篇: 1.[转]windows和linux中搭建python集成开发环境IDE 2.[转]linux和windows下安装python集成开发环境及其python包 3.windows和l ...

  2. 【OpenPose-Windows】OpenPose+VS2015+Windows+CUDA8+cuDNN5.1 官方配置教程(转载)

    [我的电脑配置] 操作系统:Windows 10 CUDA版本:cuda_8.0.61_win10 cuDNN版本:cudnn-8.0-windows10-x64-v5.1 GPU model:Nvi ...

  3. 【转载】如何删除Windows远程桌面保存的账号密码数据

    在Windows系统中,无论是win7.win8还是win10系统,都可使用Windows系统自带的远程桌面连接工具来远程服务器,很多时候Windows远程桌面在连接一次后会自动保存连接的账号密码等信 ...

  4. POJ 3923 HDU 2487 Ugly Windows 简单计算

    Ugly Windows Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tot ...

  5. HDU 2487 Ugly Windows(暴力)(2008 Asia Regional Beijing)

    Description Sheryl works for a software company in the country of Brada. Her job is to develop a Win ...

  6. 【Git】GitHub for Windows使用(3) GitHub Flow的使用

    第三章了,关于GitHub上有一个Pull Request,是展示本项目或资源所有的Pull 请求的. 而这个开发流程是基于GitHub Flow的开发模式. 网上关于GitHub Flow简单的介绍 ...

  7. 【转】如何在Windows+VS2005使用最新静态libcurl 7.35.0获取网页数据,支持HTTPS

    地址: http://blog.csdn.net/hujkay作者:Jekkay Hu(34538980@qq.com)关键词:Windows,curl,ssl,  visual c++ 2005, ...

  8. 【HDOJ】4729 An Easy Problem for Elfness

    其实是求树上的路径间的数据第K大的题目.果断主席树 + LCA.初始流量是这条路径上的最小值.若a<=b,显然直接为s->t建立pipe可以使流量最优:否则,对[0, 10**4]二分得到 ...

  9. 【Git】GitHub for Windows使用(1)

    目录 1.下载GitHub for windows 客户端 2.注册GitHub 3.启动windows端客户端,登录帐号 4.了解Git客户端,从而了解Git的大体功能 5.创建一个新的资源库  6 ...

随机推荐

  1. mysql 异常处理实例

    1. 语法: DECLARE handler_action HANDLER FOR condition_value [, condition_value] ... statement handler_ ...

  2. JAAS authentication in Tomcat example--reference

    In this tutorial you will learn how to configure JAAS authentication in Tomcat using the HTTP Basic ...

  3. 第一篇、Apache和Tomcat的整合

    1.web架构 首先上图,解释web通用架构 通常情况下分为三大块 : ★ Web server :  通常情况下由 Apache Http Server  . IBM Http Server  .I ...

  4. 读取xml时,遇到xmlns的问题

    1.读取xml的时候,由于xml里有xmlns的属性,导致了读xml无法正常读取.通过网上搜索,发现需要先注册命名空间.  xmlns是XML Namespaces的缩写,中文名称是XML(标准通用标 ...

  5. You must not call setTag() on a view Glide is targeting

    概述 在使用Glide加载图片时,如果出现"You must not call setTag() on a view Glide is targeting"的错误,八成是在使用Li ...

  6. jquery ui 插件------------------------->sortable

    <!doctype html><html lang="en"><head>  <meta charset="utf-8" ...

  7. shell脚本学习之if..else用法

    一 简介 1 字符串判断 str1 = str2 当两个串有相同内容.长度时为真  str1 != str2 当串str1和str2不等时为真  -n str1 当串的长度大于0时为真(串非空)  - ...

  8. tableView尾部多处一部分空白高度

    问题出现的原因:创建tableView时使用的style是UITableViewStylePlain 解决办法: 在创建tableView时,self.automaticallyAdjustsScro ...

  9. 注解SpringMVC

    <!--注解映射器 --> <bean class="org.springframework.web.servlet.mvc.method.annotation.Reque ...

  10. jacob 操作word

    1. 首先下载jacob-1.18.zip,解压后有两个文件jacob.jar 和 jacob.dll.需要把jacob.jar放到你工程的classpath中并且把jacob.dll放到jdk的bi ...