整整两天了,都打不开网页,是不是我提交的次数太多了?
nyoj 10:
1 #include<stdio.h> 2 #include<string.h> 3 int a[103][103],b[103][103]; 4 int X,Y; 5 int maxx(int a,int b) 6 { 7 return a>b?a:b; 8 } 9 int max(int a,int b,int c,int d) 10 { 11 return maxx(maxx(a,b),maxx(c,d)); 12 } 13 int kkk(int x,int y,int c) 14 { 15 if(x==0||y==0||x>X||y>Y||a[x][y]>=c) 16 return 0; 17 if(b[x][y]>=0) 18 return b[x][y]; 19 b[x][y]=max(kkk(x+1,y,a[x][y]),kkk(x-1,y,a[x][y]),kkk(x,y-1,a[x][y]),kkk(x,y+1,a[x][y]))+1; 20 return b[x][y]; 21 } 22 int main() 23 { 24 // freopen("250.txt","r",stdin); 25 int t,i,j,maxi,k; 26 scanf("%d",&t); 27 while(t--) 28 { 29 maxi=-1; 30 memset(b,-1,sizeof(b)); 31 scanf("%d%d",&X,&Y); 32 for(i=1;i<=X;i++) 33 for(j=1;j<=Y;j++) 34 scanf("%d",&a[i][j]); 35 for(i=1;i<=X;i++) 36 for(j=1;j<=Y;j++) 37 { 38 k=kkk(i,j,10001); 39 if(k>maxi) 40 maxi=k; 41 } 42 printf("%d ",maxi); 43 } 44 return 0; 45 }