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 |
Re:应该没什么变态的吧In Reply To:Re:应该没什么变态的吧 Posted by:61077798 at 2005-11-10 17:36:17 请试一下(你可在电脑上运行一下) #include "stdio.h" int T=0; int d=0; void fineLength(int a[100][100],int i,int j,int min,int m,int n){ int b[100][100]; if(a[i][j]!=min){ if(j+1<n) if(a[i][j]>a[i][j+1]){ T=T+1; fineLength(a,i,j+1,min,m,n); T=T-1; } if(j-1>=0) if(a[i][j]>a[i][j-1]){ T=T+1; fineLength(a,i,j-1,min,m,n); T=T-1; } if(i+1<m) if(a[i][j]>a[i+1][j]){ T=T+1; fineLength(a,i+1,j,min,m,n); T=T-1; } if(i-1>=0) if(a[i][j]>a[i-1][j]){ T=T+1; fineLength(a,i-1,j,min,m,n); T=T-1; } } if(T>d) d=T; } main(){ int a[100][100]; int b,c,e=0; int i=0,j=0; int n,m; /*freopen("sources.txt","r",stdin); freopen("rRR.txt","w",stdout);*/ scanf("%d %d",&m,&n); for(i=0;i<m;i++) for(j=0;j<n;j++){ scanf("%d",&a[i][j]); if(a[i][j]>=e){ e=a[i][j]; b=i; c=j; } } for(i=0;i<m;i++) for(j=0;j<n;j++){ if(a[i][j]<=e) e=a[i][j]; } /*for(i=0;i<m;i++) for(j=0;j<n;j++){ printf("\n %d ",a[i][j]); } */ fineLength(a,b,c,e,m,n); printf("%d",d+1); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator