Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
能看看我为啥错了吗?#include <iostream> using namespace std; int main() { int hang,lie,hight[101][101],path[101][101],max=0,Continue=1; cin >> hang >> lie; for (int i=0;i<hang;i++) { for(int j=0;j<lie;j++) { path[i][j]=1; } } for (int i=0;i<hang;i++) { for(int j=0;j<lie;j++) { cin >> hight[i][j]; } } while (Continue) { Continue=0; for (int i=0;i<hang;i++) for(int j=0;j<lie;j++) { // to one point,but the directions?? if (j>0) if (hight[i][j]>hight[i][j-1]) if (path[i][j-1]>path[i][j]-1) { Continue=1; path[i][j]=path[i][j-1]+1; if (max<path[i][j]) max=path[i][j]; } if (j<lie-1) if (hight[i][j]>hight[i][j+1]) if (path[i][j+1]>path[i][j]-1) { Continue=1; path[i][j]=path[i][j+1]+1; if (max<path[i][j]) max=path[i][j]; } if (i>0) if (hight[i][j]>hight[i-1][j]) if (path[i-1][j]>path[i][j]-1) { Continue=1; path[i][j]=path[i-1][j]+1; if (max<path[i][j]) max=path[i][j]; } if (i<hang-1) if (hight[i][j]>hight[i+1][j]) if (path[i+1][j]>path[i][j]-1) { Continue=1; path[i][j]=path[i+1][j]+1; if (max<path[i][j]) max=path[i][j]; } } } cout <<max; //system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator