0 then balls [i, j]: = t [i, j, 1] * t [i, j, 2]/kol_d
else balls [i, j]: = t [i, j, 1] * t [i, j, 3];
a [i, j, 3]: = round (balls [i, j]);
{Вихідні}
if a [i, j, 6] = 0 then begin a [i, j, 4]: = round (1.5 * t [i, j, 1] * t [i, j, 4]/kol_d);
balls [i, j]: = balls [i, j] + t [i, j, 1] * t [i, j, 4]/kol_d; end
else begin balls [i, j]: = balls [i, j] + t [i, j, 1] * t [i, j, 5];
a [i, j, 4]: = round (1.5 * t [i, j, 1] * t [i, j, 5]); end;
{Понаднормові}
if a [i, j, 6] <> 0 then begin balls [i, j]: = balls [i, j] + t [i, j, 1] * (t [i, j, 6] + t [i, j, 7]);
a [i, j, 5]: = round (t [i, j, 1] * (1.5 * t [i, j, 6] +2 * t [i, j, 7])); end
else begin balls [i, j]: = balls [i, j] + t [i, j, 1] * (t [i, j, 6] + t [i, j, 7])/8/kol_d; p>
a [i, j, 5]: = round (t [i, j, 1] * (1.5 * t [i, j, 6] +2 * t [i, j, 7])/8/kol_d); end;
{Розрахунок балів}
balls [i, j]: = balls [i, j] * ktu [i, j];
if a [i, j, 6] <> 0 then br: = br + balls [i, j] else bi: = bi + balls [i, j];
for h: = 3 to 5 do fzp: = fzp-a [i, j, h]; {Зменшення ФЗП}
end;
{writeln ('bi: ', Round (bi),' br: ', round (br));}
{Надбавка за КТУ}
nkr: = 0.75 * fzp/br; nki: = 0.25 * fzp/bi;
{writeln ('fzp ', Round (fzp));}
p: = 0;
q: = 1;
{Цикл оптимізації}
repeat
if round (Oc_m + oc_m * 1.5 * nki)> round (tar_rab * 8 * kol_d + tar_rab * 8 * kol_d * 1.5 * nkr)
then begin p: = p + q; q: = q/10; end;
p: = p-q;
nkr: = (1-p) * fzp/br;
nki: = p * fzp/bi;
{writeln (round (Oc_m + oc_m * 1.5 * nki), '', round (tar_rab * 8 * kol_d + tar_rab * 8 * kol_d * 1.5 * nkr));
writeln ('oc_m ', Round (oc_m),' nki ', round (nki));
writeln ('oc_m ', Round (oc_m),' nkr ', round (nkr));}
until round (Oc_m + oc_m * 1.5 * nki) <> round (tar_rab * 8 * kol_d + tar_rab * 8 * kol_d * 1.5 * nkr);
{writeln ('ok', round (Oc_m + oc_m * 1.5 * nki), '', round (tar_rab * 8 * kol_d + tar_rab * 8 * kol_d * 1.5 * nkr));
writeln ('ok nkr: ', Round (nkr),' nki: ', nki);}
{Зарплата за КТУ виплисти. робочим}
for i: = 1 to 3 do
for j: = 1 to kol_vo [i] do a [i, j, 7]: = round (nkr * balls [i, j]);
{Зарплата за КТУ виплисти. ІТП}
for j: = 1 to kol_vo [i] do a [4, j, 7]: = round (nki * balls [4, j]);
{Підсумкове підсумовування}
for i: = 1 to 4 do
for j: = 1 to kol_vo [i] do begin
a [i, j, 17]: = 0; a [i, j, 20]: = 0;
for h: = 3 to 5 do a [i, j, 17]: = a [i, j, 17] + a [i, j, h];
for h: = 7 to 16 do a [i, j, 17]: = a [i, j, 17] + a [i, j, h];
for h: = 17 to 19 do a [i, j, 2...