Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const
- n = 30;
- INF = -10000000;
- type
- vector = array[1..30] of real;
- var
- x,y,z: vector;
- i: integer;
- xmin, ymin, zmin, res: real;
- function min(a:real; b:real): real;
- begin
- if b < a then
- min := b
- else
- min := a;
- end;
- function multi(a: vector; b:vector): real;
- var
- i: integer;
- sum: real;
- begin
- for i:=1 to n do
- sum:=sum + a[i] * b[i];
- multi:=sum;
- end;
- begin
- // ввод вектора x
- for i := 1 to n do
- read(x[i]);
- // ввод вектора y
- for i := 1 to n do
- read(y[i]);
- // ввод вектора z
- for i := 1 to n do
- read(z[i]);
- xmin:= INF;
- ymin:= INF;
- zmin:= INF;
- // ищем минимум
- for i := 1 to n do
- begin
- xmin := min(xmin, x[i]);
- ymin := min(ymin, y[i]);
- zmin := min(zmin, z[i]);
- end;
- if (ymin>xmin) and (ymin>zmin) then
- res := multi(y,y) - multi(x,z)
- else if (xmin>ymin) and (xmin>zmin) then
- res := multi(x,x) - multi(y,z)
- else
- res := multi(z,z) - multi(x,y);
- writeln('Result: ', res);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement