Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program project2;
- const
- KapacitaPrvku: array [1..48] of real = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33.1, 33.2, 33.3, 34.4, 34.5, 34.6, 34.7, 34.8, 34.9, 35, 35.1, 35.2, 35.3, 35.4, 35.5);
- var
- A01: array [1..36] of integer;
- A02: array [1..33] of integer;
- A03: array [1..30] of integer;
- A04: array [1..27] of integer;
- A05: array [1..24] of integer;
- A06: array [1..21] of integer;
- A07: array [1..18] of integer;
- A08: array [1..15] of integer;
- A09, B: array [1..12] of integer;
- A10: array [1..9] of integer;
- A11: array [1..6] of integer;
- A12: array [1..3] of integer;
- A: array [1..12, 1..4] of integer;
- S: array [1..12] of real;
- B1, B2, B3, B5, B6, B7, B9, B10, B11, B13, B14, B15, B17, B18, B19, B21, B22, B23, B25, B26, B27, B29, B30, B31, B33, B34, B35, B37, B38, B39, B41, B42, B43: integer;
- MIN, MAX, DELTA, MINDELTA: real;
- I, J, K, n: integer;
- begin
- MINDELTA := 999;
- n := 48;
- J := 1;
- K := 1;
- for I := 1 to n do
- if KapacitaPrvku[I] < 34 then
- begin
- A01[J] := I;
- J := J + 1
- end
- else
- begin
- B[K] := I;
- K := K + 1;
- end;
- //n := 36;
- for B1 := A01[3] to 36 do
- for B2 := A01[2] to B1 - 1 do
- for B3 := A01[1] to B2 - 1 do
- begin
- J := 1;
- for I := 1 to 36 do
- if (B1 <> A01[I]) and (B2 <> A01[I]) and (B3 <> A01[I]) then
- begin
- A02[J] := A01[I];
- J := J + 1
- end ;
- //n := 33;
- for B5 := A02[3] to 33 do
- for B6 := A02[2] to B5 - 1 do
- for B7 := A02[1] to B6 - 1 do
- begin
- J := 1;
- for I := 1 to 33 do
- if (B5 <> A02[I]) and (B6 <> A02[I]) and (B7 <> A02[I]) then
- begin
- A03[J] := A02[I];
- J := J + 1
- end ;
- //n := 30;
- for B9 := A03[3] to 30 do
- for B10 := A03[2] to B9 - 1 do
- for B11 := A03[1] to B10 - 1 do
- begin
- J := 1;
- for I := 1 to 30 do
- if (B9 <> A03[I]) and (B10 <> A03[I]) and (B11 <> A03[I]) then
- begin
- A04[J] := A03[I];
- J := J + 1
- end ;
- //n := 27;
- for B13 := A04[3] to 27 do
- for B14 := A04[2] to B13 - 1 do
- for B15 := A04[1] to B14 - 1 do
- begin
- J := 1;
- for I := 1 to 27 do
- if (B13 <> A04[I]) and (B14 <> A04[I]) and (B15 <> A04[I]) then
- begin
- A05[J] := A04[I];
- J := J + 1
- end ;
- write('.');
- //n := 24;
- for B17 := A05[3] to 24 do
- for B18 := A05[2] to B17 - 1 do
- for B19 := A05[1] to B18 - 1 do
- begin
- J := 1;
- for I := 1 to 24 do
- if (B17 <> A05[I]) and (B18 <> A05[I]) and (B19 <> A05[I]) then
- begin
- A06[J] := A05[I];
- J := J + 1
- end ;
- //n := 21;
- for B21 := A06[3] to 21 do
- for B22 := A06[2] to B21 - 1 do
- for B23 := A06[1] to B22 - 1 do
- begin
- J := 1;
- for I := 1 to 21 do
- if (B21 <> A06[I]) and (B22 <> A06[I]) and (B23 <> A06[I]) then
- begin
- A07[J] := A06[I];
- J := J + 1
- end ;
- //n := 18;
- for B25 := A07[3] to 18 do
- for B26 := A07[2] to B25 - 1 do
- for B27 := A07[1] to B26 - 1 do
- begin
- J := 1;
- for I := 1 to 18 do
- if (B25 <> A07[I]) and (B26 <> A07[I]) and (B27 <> A07[I]) then
- begin
- A08[J] := A07[I];
- J := J + 1
- end ;
- //n := 15;
- for B29 := A08[3] to 15 do
- for B30 := A08[2] to B29 - 1 do
- for B31 := A08[1] to B30 - 1 do
- begin
- J := 1;
- for I := 1 to 15 do
- if (B29 <> A08[I]) and (B30 <> A08[I]) and (B31 <> A08[I]) then
- begin
- A09[J] := A08[I];
- J := J + 1
- end ;
- //n := 12;
- for B33 := A09[3] to 12 do
- for B34 := A09[2] to B33 - 1 do
- for B35 := A09[1] to B34 - 1 do
- begin
- J := 1;
- for I := 1 to 12 do
- if (B33 <> A09[I]) and (B34 <> A09[I]) and (B35 <> A09[I]) then
- begin
- A10[J] := A09[I];
- J := J + 1
- end ;
- //n := 9;
- for B37 := A10[3] to 9 do
- for B38 := A10[2] to B37 - 1 do
- for B39 := A10[1] to B38 - 1 do
- begin
- J := 1;
- for I := 1 to 9 do
- if (B37 <> A10[I]) and (B38 <> A10[I]) and (B39 <> A10[I]) then
- begin
- A11[J] := A10[I];
- J := J + 1
- end ;
- //n := 6;
- for B41 := A11[3] to 6 do
- for B42 := A11[2] to B41 - 1 do
- for B43 := A11[1] to B42 - 1 do
- begin
- J := 1;
- for I := 1 to 6 do
- if (B41 <> A11[I]) and (B42 <> A11[I]) and (B43 <> A11[I]) then
- begin
- A12[J] := A11[I];
- J := J + 1
- end ;
- S[1] := KapacitaPrvku[B[1]] + KapacitaPrvku[B1] + KapacitaPrvku[B2] + KapacitaPrvku[B3];
- S[2] := KapacitaPrvku[B[2]] + KapacitaPrvku[B5] + KapacitaPrvku[B6] + KapacitaPrvku[B7];
- S[3] := KapacitaPrvku[B[3]] + KapacitaPrvku[B9] + KapacitaPrvku[B10] + KapacitaPrvku[B11];
- S[4] := KapacitaPrvku[B[4]] + KapacitaPrvku[B13] + KapacitaPrvku[B14] + KapacitaPrvku[B15];
- S[5] := KapacitaPrvku[B[5]] + KapacitaPrvku[B17] + KapacitaPrvku[B18] + KapacitaPrvku[B19];
- S[6] := KapacitaPrvku[B[6]] + KapacitaPrvku[B21] + KapacitaPrvku[B22] + KapacitaPrvku[B23];
- S[7] := KapacitaPrvku[B[7]] + KapacitaPrvku[B25] + KapacitaPrvku[B26] + KapacitaPrvku[B27];
- S[8] := KapacitaPrvku[B[8]] + KapacitaPrvku[B29] + KapacitaPrvku[B30] + KapacitaPrvku[B31];
- S[9] := KapacitaPrvku[B[9]] + KapacitaPrvku[B33] + KapacitaPrvku[B34] + KapacitaPrvku[B35];
- S[10] := KapacitaPrvku[B[10]] + KapacitaPrvku[B37] + KapacitaPrvku[B38] + KapacitaPrvku[B39];
- S[11] := KapacitaPrvku[B[11]] + KapacitaPrvku[B41] + KapacitaPrvku[B42] + KapacitaPrvku[B43];
- S[12] := KapacitaPrvku[B[12]] + KapacitaPrvku[A12[1]] + KapacitaPrvku[A12[2]] + KapacitaPrvku[A12[3]];
- MIN := S[1];
- MAX := S[1];
- for I := 2 to 12 do
- if MIN > S[I] then
- MIN := S[I]
- else if MAX < S[I] then
- MAX := S[I] ;
- DELTA := MAX - MIN;
- if DELTA < MINDELTA then
- begin
- A[1, 1] := B[1];
- A[1, 2] := B1;
- A[1, 3] := B2;
- A[1, 4] := B3;
- A[2, 1] := B[2];
- A[2, 2] := B5;
- A[2, 3] := B6;
- A[2, 4] := B7;
- A[3, 1] := B[3];
- A[3, 2] := B9;
- A[3, 3] := B10;
- A[3, 4] := B11;
- A[4, 1] := B[4];
- A[4, 2] := B13;
- A[4, 3] := B14;
- A[4, 4] := B15;
- A[5, 1] := B[5];
- A[5, 2] := B17;
- A[5, 3] := B18;
- A[5, 4] := B19;
- A[6, 1] := B[6];
- A[6, 2] := B21;
- A[6, 3] := B22;
- A[6, 4] := B23;
- A[7, 1] := B[7];
- A[7, 2] := B25;
- A[7, 3] := B26;
- A[7, 4] := B27;
- A[8, 1] := B[8];
- A[8, 2] := B29;
- A[8, 3] := B30;
- A[8, 4] := B31;
- A[9, 1] := B[9];
- A[9, 2] := B33;
- A[9, 3] := B34;
- A[9, 4] := B35;
- A[10, 1] := B[10];
- A[10, 2] := B37;
- A[10, 3] := B38;
- A[10, 4] := B39;
- A[11, 1] := B[11];
- A[11, 2] := B41;
- A[11, 3] := B42;
- A[11, 4] := B43;
- A[12, 1] := B[12];
- A[12, 2] := A12[1];
- A[12, 3] := A12[2];
- A[12, 4] := A12[3];
- MINDELTA := DELTA;
- writeln();
- write('[');
- for I := 1 to 12 do
- begin
- write('[');
- for J := 1 to 3 do
- begin
- write(A[I, J] : 2);
- write(', ')
- end;
- write(A[I, 4]);
- write(']');
- if I < 12 then
- write(', ') end ;
- writeln(']')
- end
- end
- end
- end end end end end end end end end;
- writeln('Done.');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement