HDU 4584
//也是简单题,因为n太小,故暴力之! #include<stdio.h>
#include<math.h>
#include<string.h>
#define max 45 char map[max][max]; int dis(int x1,int y1,int x2,int y2){
return fabs(x1-x2*1.0)+fabs(y1-y2*1.0);
} int main(){
int n,m;
while(~scanf("%d%d",&n,&m)){
if(n==&&m==){
break;
}
getchar();
for(int i=;i<n;i++){
scanf("%s",map[i]);
// puts(map[i]);
}
int ans=,x1,y1,x2,y2;
for(int i=;i<n;i++){
for(int j=;j<m;j++){
if(map[i][j]!='H'){
continue;
}
for(int k=;k<n;k++){
for(int h=;h<m;h++){
if(map[k][h]!='C'){
continue;
}
int res=dis(i,j,k,h);
if(ans>res){
ans=res;
x1=i; y1=j;
x2=k; y2=h;
}
}
}
}
}
printf("%d %d %d %d\n",x1,y1,x2,y2);
}
}
HDU 4584的更多相关文章
- hdu 4584 水题爽一发 *
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #i ...
- HDU 4584 splay
Shaolin Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Sub ...
- HDU 4584 Building bridges (水题)
Building bridges Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
随机推荐
- php7 mysql_pconnect() 缺失 解决方法
php7 兼容 MySQL 相关函数 PHP7 废除了 ”mysql.dll” ,推荐使用 mysqli 或者 pdo_mysql http://PHP.net/manual/zh/mysqlinfo ...
- poj3294Life Forms
传送门 我真是一个垃圾 模板题都不会做 模板题还要别人教 细节写法还要别人教 别人一分钟AC,教我算法还教我写法,最后写出来的别人算法还比我优秀一百倍 数据结构把脑子学傻了,看到题就想怎么用数据结构, ...
- 虚拟机vm安装黑群晖6.2
操作系统选择
- double转String
两种方式: 1.value = new DecimalFormat().format(double); 2.value = String.valueOf(double); 要相保留所有的double位 ...
- 如何学习AxureRP Axure学习方法
从作者最初接触的5.5版本,到5.6版本,到后来6.0的多个迭代版本,直到现在的6.5版本,AxureRP每次的版本升级都伴随着新功能的增 加,也解决了原型设计上的一些难题.这也从另一个方面诠释了“学 ...
- java中 &&与& ||与| 的区别
public class Demo { public static void main(String[] args) { int i = 5; int j = 3; // || 与 | 的区别 boo ...
- Oracle的UTL_FILE.FOPEN学习笔记
Oracle提供的文件操作包UTL_FILE包中的UTL_FILE.FOPEN负责打开一个文件. UTL_FILE.FOPEN(location in varchar2, filename in va ...
- occ+vtk显示igs模型
使用Opencascade读取igs文件内模型,使用vtk进行显示. 本案例环境:Opencascade6.6.0 + vtk-5.10 + VS2005(win32) 使用CMake管理工程. C ...
- cdh_hadoop下载地址
http://archive.cloudera.com/cdh5/cdh/5/
- c++容器的操作方法总结
一.map 1.创建 typedef map<int,string> descrbe_map_; descrbe_map_ devMap; 或者 map<string,string& ...