http://www.bnuoj.com/bnuoj/problem_show.php?pid=4351

【题意】:用最小的矩形框,框住像素点差超过5的点。

【题解】:求坐标x,y最大最小值

【code】:

 #include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm> using namespace std; int map[][]; int abs(int x)
{
return x<?-x:x;
} int main()
{
int n,m;
scanf("%d%d",&n,&m);
int i,j;
for(i=;i<n;i++)
{
for(j=;j<m;j++)
{
scanf("%d",&map[i][j]);
}
}
int x;
int x1=,x2=-,y1=,y2=-;
int exist=;
for(i=;i<n;i++)
{
for(j=;j<m;j++)
{
scanf("%d",&x);
if(abs(map[i][j]-x)>)
{
exist=;
if(x1>i) x1=i;
if(x2<i) x2=i;
if(y1>j) y1=j;
if(y2<j) y2=j;
}
}
}
if(exist)
{
printf("%d %d %d %d\n",x1+,y1+,x2+,y2+);
}
else
{
puts("-1");
}
return ;
}

最新文章

  1. Register-SPWorkflowService 404
  2. topcoder SRM 594 DIV2 AstronomicalRecordsEasy
  3. 青瓷qici - H5小游戏 抽奖机 0 创建工程
  4. javascript 高级程序设计(三)-数据类型
  5. RCMTM _百度百科
  6. C盘里的桌面文件移到E盘里了,然后E盘里的文件都显示到桌面上了,怎么将桌面文件还原回C盘
  7. PTA 邻接矩阵存储图的深度优先遍历
  8. delphi 微信(WeChat)多开源代码
  9. OpenMP实现生产者消费者模型
  10. WebGL绘制有宽度的线
  11. opencv3.2.0图像处理之高斯滤波GaussianBlur API函数
  12. Ubuntu18.04 VMtools的安装与卸载
  13. [Canvas]空战游戏进阶 增加己方子弹管理类
  14. MySQL 遇到错误集锦
  15. 多模块Maven项目如何使用javadoc插件生成文档
  16. Digester库使用总结
  17. Python面向对象(类的成员之属性)
  18. 2938: [Poi2000]病毒
  19. css3 3d展示中rotate()介绍与简单实现
  20. 企业级Nginx基于虚拟主机别名的设置

热门文章

  1. poj 2724 二分图最大匹配
  2. Visual Studio Team Foundation Server 2015(TFS 秘钥、序列号)
  3. 通过Jquery中Ajax获取json文件数据
  4. Redis 命令 - Sets
  5. Spring3+hibernate4框架整合
  6. SQL语句添加,删除主键
  7. kettle列转行
  8. phpmyadmin安装教程及配置设置
  9. CSS 初体验之一
  10. 笔试面试题-寻找Coder