SlepoiKrot

Untitled

Jan 3rd, 2018
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rogram B1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils;
  7. var
  8.   a, b, a2b, ab2, i, j, i1, j1, j2: integer;
  9.   ok: boolean;
  10. begin
  11.   read (a, b, a2b, ab2);
  12.   if (a = 0) then begin
  13.     i := -999;
  14.     i1 := 999;
  15.   end
  16.   else begin
  17.     i := a;
  18.     i1 := a;
  19.   end;
  20.   if (b = 0) then begin
  21.     j := -999;
  22.     j1 := 999;
  23.   end
  24.   else begin
  25.     j := b;
  26.     j1 := b;
  27.   end;
  28.   j2 := j;
  29.   ok := true;
  30.   for i := i to i1 do begin
  31.    if (ok) then begin
  32.     for j := j2 to j1 do begin
  33.       if (i < j) then
  34.         continue;
  35.       if ((a2b <> 0) and (i * i * j = a2b)) then begin
  36.         if ((ab2 <> 0) and (j * j * i = ab2)) then begin
  37.           write (i, ' ', j, ' ', a2b, ' ', ab2);
  38.           ok := false;
  39.           break;
  40.         end;
  41.       end;
  42.       if ((a2b = 0) and (ab2 <> 0) and (j * j * i = ab2)) then begin
  43.         write (i, ' ', j, ' ', i * i * j, ' ', ab2);
  44.         ok := false;
  45.         break;
  46.       end;
  47.       if ((ab2 = 0) and (a2b <> 0) and (i * i * j = a2b)) then begin
  48.         write (i, ' ', j, ' ', a2b, ' ', j * j * i);
  49.         ok := false;
  50.         break;
  51.       end;
  52.       if ((ab2 = 0) and (a2b = 0)) then begin
  53.         write (i, ' ', j, ' ', i * i * j, ' ', j * j * i);
  54.         ok := false;
  55.         break;
  56.       end;
  57.     end;
  58.    end
  59.    else
  60.     break;
  61.   end;
  62.   readln;
  63.   readln;
  64. end.
RAW Paste Data