Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
61
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
  16. begin
  17.     CA:=true;
  18. 1:
  19.     if CB then
  20.         if Q=1 then goto 1
  21.         else
  22.         begin
  23.             CA:=false;
  24.             while Q=2 do;
  25.         end
  26.     else
  27.     begin
  28.         if O.size() <> max then
  29.             if T.size > 0 then
  30.                 O.add(T.peek())
  31.         Q:=2;
  32.         CA:=false;
  33.     end
  34. end;
  35.  
  36. Process 2
  37.  
  38. while true do
  39. begin
  40.     CB:=true;
  41. 2:
  42.     if CA then
  43.         if Q=2 then goto 2
  44.         else
  45.         begin
  46.             CB:=false;
  47.             while Q=1 do;
  48.         end
  49.     else
  50.     begin
  51.         if O.size() > 0 then
  52.             O.pop();
  53.         Q:=1;
  54.         CB:=false;
  55.     end
  56. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement