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