The Best Seat in ACM Contest
来源:互联网 发布:mac安装raysource 编辑:程序博客网 时间:2024/04/24 17:56
一开始把行和列弄反了,结果总是不对,到最后总是找出来了。
#include<stdio.h>int y[107][107];int z[107][107];int m,n;int count=0,number=0,max,x1=0,y1=0,flag=1;int dir[4][2]= {{-1,0},{1,0},{0,1},{0,-1}};void bfs(int x2,int y2){ int xx,yy; for(int e=0; e<4; e++) { xx=x2+dir[e][0]; yy=y2+dir[e][1]; if(xx<0||xx>=m||yy<0||yy>=n) { count--; continue; } if(y[xx][yy]>y[x2][y2]) { number=y[xx][yy]-y[x2][y2]; count+=number; } else { number=y[x2][y2]-y[xx][yy]; count-=number; } }}int main(){ int t; scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); for(int a=0; a<m; a++) for(int b=0; b<n; b++) scanf("%d",&y[a][b]); for(int c=0; c<m; c++) for(int d=0; d<n; d++) { bfs(c,d); z[c][d]=count; count=0; } max=z[0][0]; for(int g=0; g<m; g++) for(int h=0; h<n; h++) { //printf("%d ",z[g][h]); if(z[g][h]>=max) { max=z[g][h]; x1=g; y1=h; } } printf("Case %d: %d %d %d\n",flag++,max,x1+1,y1+1); } return 0;}
- [ACM]The Best Seat in ACM Contest
- 省赛 The Best Seat in ACM Contest
- The Best Seat in ACM Contest
- The Best Seat in ACM Contest
- The Best Seat in ACM Contest
- sdut2409 The Best Seat in ACM Contest
- 第三届山东省ACM The Best Seat in ACM Contest
- SOJ 2409 The Best Seat in ACM Contest (BFS)
- SDUT 2409:The Best Seat in ACM Contest
- [2012山东省第三届ACM大学生程序设计竞赛]——The Best Seat in ACM Contest
- [2012山东ACM省赛] The Best Seat in ACM Contest (模拟)
- Sdut 2409 The Best Seat in ACM Contest(山东省第三届ACM省赛 H 题)(模拟)
- 山东省第三届ACM竞赛 The Best Seat in ACM Contest
- 山东省第三届ACM省赛题——The Best Seat in ACM Contest(模拟)
- 2013山东省第三届ACM省赛 The Best Seat in ACM Contest
- 山东省第三届ACM大学生程序设计竞赛 The Best Seat in ACM Contest
- The Best Seat in ACM Contest--12年山东省赛(广搜)需要记录数组
- 2012年"浪潮杯"山东省第三届ACM大学生程序设计竞赛:The Best Seat in ACM Contest
- [python相关]python 访问网页
- Linux 2.6 中的文件锁
- Ubuntu的FTP服务配置
- ubuntu如何开启SSH服务
- Random Thoughts #12 @2013:P2P狂想曲
- The Best Seat in ACM Contest
- 利用FileZilla和SSH Secure Shell Client通过ssh上传和下载Ubuntu上文件
- 【编程语言】java--jvm的内部体系结构浅析
- Ubuntu12.04下卸载openJDK java 安装sun java
- 字符串处理函数
- ubuntu10.10 下解压android-ndk-r8-linux-x86.tar.bz2出错
- C语言经典实例一
- Ubuntu 10.10下SSH的配置和使用
- 工作感想之项目重构