- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
program gays;
uses crt;
var k,k1,kn,n,i,j:integer;
a,c:array [1..100,1..100] of real;
f,x,b,d:array [1..100] of real;
r:real;
begin
repeat
Write ('put poriadok n<100, n=');
readln(n);
until n<100;
for i:=1 to n do
begin
for j:=1 to n do
begin
write('a [',i,';',j,']=');
readln(a[i,j]);
c[i,j]:=a[i,j];
end;
write('b [',i,']=');
readln(b[i]);
d[i]:=b[i];
end;
//3blok
for k:=1 to (n-1) do
begin
//4 blok
if a[k,k]=0 then
begin
k1:=k;
repeat
k1:=k1+1 ;
until (a[k1,k]<>0) or (k1>n);
if a[k1,k]=0 then
begin
writeln('Vedushii elementi ravni nuly');
halt;
end;
kn:=k1;
for j:=1 to n do
begin
r:=a[k,j];
a[k,j]:=a[kn,j];
a[kn,j]:=r;
end;
r:=b[k];
b[k]:=b[kn];
b[kn]:=r;
end;
//5 blok
b[k]:=b[k]/a[k,k];
for i:=(k+1) to n do
b[i]:=b[i]-a[i,k]*b[k];
for j:=(k+1) to n do
begin
a[k,j]:=a[k,j]/a[k,k];
for i:=(k+1) to n do
a[i,j]:=a[i,j]-a[i,k]*a[k,j];
end;
end;
//end 3 blok
x[n]:=b[n]/a[n,n];
// 7 blok
for i:=(n-1) downto 1 do
begin
for j:=i+1 to n do
b[i]:=b[i]-x[j]*a[i,j] ;
x[i]:=b[i];
end;
// 8 blok
for i:=1 to n do
if x[i]<0 then writeln ('nomer otricatelnogo kornia =',i);
for j:=1 to n do writeln('x[',j,']=',x[j]:10:4);
// 9 blok
for i:=1 to n do
begin
f[i]:=-d[i];
for j:=1 to n do
f[i]:=f[i]+c[i,j]*x[j];
writeln('F=',f[i]:10:4);
end;
readkey;
end.
Очередной высер стажера при написании учетного решения в 1С