03
Май
2020

Преобразование кода из Pascal в Python

program Si-Re-Ti;
uses
  SysUtils;

const
y1_t=-3000;
y2_t=250;
y3_t=350;
y12_t=90;
y13_t=150;
y23_t=200;
y123_t=225;
y1_r=10000;
y2_r=350;
y3_r=400;
y12_r=2000;
y13_r=2800;
y23_r=500;
y123_r=900;
var
   Si, Re, Ti: integer;
  b123_t,b12_t, b13_t, b23_t, b12_r, b13_r, b23_r,  b123_r, b1_t, b2_t,b3_t, b1_r, b2_r, b3_r: real;
  tks, ro:array[0..101, 0..101, 0..101] of real;
begin
  b1_t:=y1_t;
  b2_t:=y2_t;
  b3_t:=y3_t;
    b12_t:=4*y12_t-2*y1_t-2*y2_t;
    b13_t:=4*y13_t-2*y1_t-2*y3_t;
    b23_t:=4*y23_t-2*y2_t-2*y3_t;
      b123_t:=27*y123_t-12*(y12_t+y13_t+y23_t)+3*(y1_t+y2_t+y3_t);

  b1_r:=y1_r;
  b2_r:=y2_r;
  b3_r:=y3_r;
    b12_r:=4*y12_r-2*y1_r-2*y2_r;
    b13_r:=4*y13_r-2*y1_r-2*y3_r;
    b23_r:=4*y23_r-2*y2_r-2*y3_r;
      b123_r:=27*y123_r-12*(y12_r+y13_r+y23_r)+3*(y1_r+y2_r+y3_r);

Re:=0;
Si:=100;
Ti:=0;
while Re<=100 do
  begin
  Ti:=0;
  Si:=100-Re;
while Si>=0 do
  begin
tks[Si,Re,Ti]:= b1_t*Si/100+b2_t*Re/100+b3_t*Ti/100+b12_t*Si*Re/10000+b13_t*Si*Ti/10000+b23_t*Re*Ti/10000+b123_t*Si*Re*Ti/1000000;
ro[Si,Re,Ti]:= b1_r*Si/100+b2_r*Re/100+b3_r*Ti/100+b12_r*Si*Re/10000+b13_r*Si*Ti/10000+b23_r*Re*Ti/10000+b123_r*Si*Re*Ti/1000000;
Si:=Si-5;
Ti:=Ti+5;
end;
Re:=Re+5;

end;

потом вывод через writeln

Источник: https://ru.stackoverflow.com/questions/1119781/%D0%9F%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BA%D0%BE%D0%B4%D0%B0-%D0%B8%D0%B7-pascal-%D0%B2-python

Тебе может это понравится...

Добавить комментарий