Guest User

Untitled

a guest
Jul 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.73 KB | None | 0 0
  1. var
  2. a:array[1..1000, 1..1000] of boolean;
  3. b:array[1..1000, 1..1000] of boolean;
  4. c:array[1..1000, 1..1000] of integer;
  5. d:array[1..10] of boolean;
  6. m,t,n,i,j,p,k:longint;
  7. procedure max(x,y:longint);
  8. begin
  9. b[x,y]:=true;
  10. if (x>1) and (b[x-1,y]=false) and (a[x-1,y]=true)then
  11. max((x-1),y);
  12. if (y>1) and (b[x,y-1]=false) and (a[x,y-1]=true) then
  13. max(x,(y-1));
  14. if (y<n) and (b[x,y+1]=false) and (a[x,y+1]=true) then
  15. max (x,(y+1));
  16. if (x<m) and (b[x+1,y]=false) and (a[x+1,y]=true) then
  17. max(x+1,y);
  18. end;
  19.  
  20.  
  21. begin
  22. randomize;
  23. read(m,n);
  24. for i:=1 to m do
  25. for j:=1 to n do
  26. c[i,j]:=random(9);
  27.     for k:=1 to 1023 do
  28.     begin
  29.     k:=0;
  30.     for i:=1 to 10 do
  31.     if k and (1 shl i)=true then
  32.     begin
  33.     k:=k+1;
  34.     d[i]:=true
  35.     end
  36.     else d[i]:=false;
Add Comment
Please, Sign In to add comment