码迷,mamicode.com
首页 > 其他好文 > 详细

数组-09. 求矩阵的局部极大值(15)

时间:2014-07-05 17:54:27      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   for   io   

 1 #include<iostream>
 2 using namespace std;
 3 int main(){
 4     int i,j,m,n,a[21][21];
 5     bool flag=true;
 6     cin>>m>>n;
 7     for(i=0;i<m;++i)
 8         for(j=0;j<n;++j)
 9             cin>>a[i][j];
10     for(i=1;i<m-1;++i)
11         for(j=1;j<n-1;++j)
12             if(a[i][j]>a[i][j-1]&&a[i][j]>a[i][j+1]
13                 &&a[i][j]>a[i-1][j]&&a[i][j]>a[i+1][j]){
14                 cout<<a[i][j]<<" "<<i+1<<" "<<j+1<<endl;
15                 flag=false;
16             }
17     if(flag)
18         cout<<"None "<<m<<" "<<n<<endl;
19     return 0;
20 }

 

数组-09. 求矩阵的局部极大值(15),布布扣,bubuko.com

数组-09. 求矩阵的局部极大值(15)

标签:style   blog   color   os   for   io   

原文地址:http://www.cnblogs.com/gnodidux/p/3822857.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!