Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.30 KB | None | 0 0
  1. program Project1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils,
  7.   windows;
  8.  
  9. const m = 10;
  10.   n = 10;
  11.  
  12.  
  13. type MAS = array[0..9, 0..9] of integer;
  14.   TRange = 0..255;
  15.   TSet = set of TRange;
  16. const
  17.   Q: MAS = (
  18.     (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
  19.     (0, 5, 2, 3, 4, 5, 6, 7, 8, 9),
  20.     (0, 9, 2, 3, 4, 5, 6, 7, 8, 9),
  21.     (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
  22.     (0, 7, 2, 3, 4, 5, 6, 7, 8, 9),
  23.     (0, 3, 2, 3, 4, 5, 6, 7, 8, 9),
  24.     (0, 4, 2, 3, 4, 5, 6, 7, 8, 9),
  25.     (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
  26.     (15, 14, 13, 12, 11, 10, 9, 8, 7, 6),
  27.     (15, 14, 13, 12, 11, 10, 9, 8, 7, 6)
  28.     );
  29.  
  30. var
  31.   x: MAS;
  32.   i, j, k, result: integer;
  33.   x1, x2, x3: TSet;
  34. begin
  35.  
  36.   SetConsoleCP(1251);
  37.   SetConsoleOutputCP(1251);
  38.  
  39.   x1 := [];
  40.   x2 := [];
  41.   x3 := [];
  42.   result := 0;
  43.   i := 0;
  44.                                            
  45.   while i < 10 do // i-ñòðîêà => j-ñòîëáåö
  46.   begin
  47.     for j := 0 to 9 do
  48.       include(x1, Q[i, j]);
  49.     inc(i);
  50.     k := i;
  51.     while i < 10 do
  52.     begin
  53.       for j := 0 to n - 1 do
  54.         include(x2, Q[i, j]); ;
  55.       if x1 = x2 then
  56.       begin
  57.         x3 := x3 + x1;
  58.         inc(result);
  59.       end;
  60.       x2 := [];
  61.       inc(i);
  62.     end;
  63.     x1 := [];
  64.     i := k + 1;
  65.   end;
  66.  
  67.   writeln('êîë-âî ñòðîê=', result);
  68.   readln;
  69. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement