Advertisement
Semior001

Pilschikov 11.13

Oct 5th, 2016
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.74 KB | None | 0 0
  1. type
  2.     vector = array[1..40] of integer;
  3. var
  4.     x,y,z: vector;
  5.     n,i: integer;
  6.     max_x, max_z_pos: integer;
  7.     is_y_negative: boolean;
  8.  
  9. function max(a: real; b: real): real;
  10. begin
  11.     if a>b then
  12.         max:=a
  13.     else
  14.         max:=b;
  15. end;
  16.  
  17. begin
  18.     readln(n);
  19.     max_x := -1000000;
  20.     for i:=1 to n do
  21.     begin
  22.         read(x[i]);
  23.         max_x := max(max_x, x[i]);
  24.     end;
  25.     is_y_negative:=true;
  26.     for i:=1 to n do
  27.     begin
  28.         read(y[i]);
  29.         if is_y_negative and (y[i]>0) then
  30.             is_y_negative:=false;
  31.     end;
  32.     max_z_pos:= 1;
  33.     read(z[1]);
  34.     for i:=2 to n do
  35.     begin
  36.         read(z[i]);
  37.         if z[i]>z[max_z_pos] then
  38.             max_z_pos:=i;
  39.     end;
  40.     if (max_x = 10) and (is_y_negative) then
  41.         for i:=1 to max_z_pos-1 do
  42.             z[i]:=z[i]*z[i]*z[i];
  43.     for i:=1 to n do
  44.         write(z[i],' ');
  45. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement