PROGRAM PDP(A,B); CONST E = 1; VAR A, B : TEXT; MAX,C : REAL; I,J,N : INTEGER; P : ARRAY[1..1000000] OF INTEGER; BEGIN ASSIGN(A,'profit.in'); RESET(A); { Read the first number of the file into the variable N } READ(A,N); { Put the numbers of the second line into the array P } FOR I := 0 TO N-1 DO BEGIN READ(A,P[I]); END; { Find max earning } MAX:=-1.000; FOR I := 1 TO N-1 DO BEGIN {WRITELN(P[I]);} FOR J := (I-1) downto 0 DO BEGIN C := (P[I]/P[J]); IF C > MAX THEN MAX := C; END; END; { Write the result MAX into the file profit.out } ASSIGN(B,'profit.out'); REWRITE(B); WRITE(B,MAX:0:3); WRITELN(B,''); CLOSE(B); CLOSE(A) END.