lygmh @ 2019-02-27 15:48:11
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
int p[4]={ 0, 0, 1,-1};
int q[4]={-1, 1, 0, 0};
int map[102][102];
int used[102][102];
int m,n;
int ans;
void dfs(int x,int y,int step) {
if(x>m||y>n||x<=0||y<=0) return ;
if(used[x][y]>=step) return ;
used[x][y]=step;
ans=max(ans,step);
for(int i=0;i<4;i++){
if(map[x][y]>map[x+p[i]][y+q[i]]){
dfs(x+p[i],y+q[i],step+1);
}
}
}
int main() {
cin>>m>>n;
for(int i=1; i<=m; i++) {
for(int j=1; j<=n; j++) {
cin>>map[i][j];
}
}
for(int i=1; i<=n; i++) {
for(int j=1; j<=m; j++) {
dfs(i,j,1);
}
}
cout<<ans;
return 0;
}
by OBJECT_705X @ 2019-02-27 18:14:05
main函数两个for循环怎么回事,一个先m再n,一个先n再m???你的m和n不如R和C表达的意思清楚啊