Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.61 KB | None | 0 0
  1. Var
  2.     CA,CB:Boolean;
  3.     Q:Byte;
  4.     O,T:Queue;
  5.     max:Integer;
  6. Begin
  7.     CA:=false;
  8.     CB:=false;
  9.     Q:=2;  
  10.     max:=10;
  11.  
  12.  
  13. Process 1
  14.  
  15. while true do begin
  16.     CA:=true;
  17. 1:
  18.     if CB then
  19.         if Q=1 then goto 1
  20.         else begin
  21.             CA:=false;
  22.             while Q=2 do;
  23.              end
  24.     else begin
  25.         if O.size() <> max then
  26.             if T.size > 0 then
  27.                 O.add(T.peek())
  28.         Q:=2;
  29.         CA:=false;
  30.          end
  31. end;
  32.  
  33.  
  34. Process 2
  35.  
  36. while true do begin
  37.     CB:=true;
  38. 2:
  39.     if CA then
  40.         if Q=2 then goto 2
  41.         else begin
  42.             CB:=false;
  43.             while Q=1 do;
  44.              end
  45.     else begin
  46.         if O.size() > 0 then
  47.             O.pop();
  48.         Q:=1;
  49.         CB:=false;
  50.          end
  51. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement