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 |
帮帮忙{$q-,r-,s-} program pku1088; const d1:array[1..4]of integer=(-1,0,1,0); d2:array[1..4]of integer=(0,1,0,-1); var m,n,i,j,k,min,max,x,y,p,q:integer; c,len:array[1..100,1..100]of integer; b:array[1..100,1..100]of boolean; function check:boolean; var i,j:integer; begin check:=false; for i:=1 to m do for j:=1 to n do begin if b[i,j] then begin check:=true; exit; end; end; end; procedure mmin; var i,j:integer; begin min:=maxint; for i:=1 to m do for j:=1 to n do begin if b[i,j] and(c[i,j]<min) then begin min:=c[i,j]; x:=i;y:=j; end; end; end; begin fillchar(c,sizeof(c),0); fillchar(len,sizeof(len),0); fillchar(b,sizeof(b),true); readln(m,n); for i:=1 to m do begin for j:=1 to n do begin read(c[i,j]); end; readln; end; mmin;len[x,y]:=1; while check do begin mmin;b[x,y]:=false; for i:=1 to 4 do begin if (x+d1[i]<=m)and(x+d1[i]>0)and(y+d2[i]<=n) and(y+d2[i]>0) then begin if (c[x+d1[i],y+d2[i]]>c[x,y]) and(len[x+d1[i],y+d2[i]]<len[x,y]+1) then len[x+d1[i],y+d2[i]]:=len[x,y]+1; end; end; end; max:=0; for i:=1 to m do for j:=1 to n do if len[i,j]>max then max:=len[i,j]; writeln(max); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator