|
|
вернуться в форумPlease help ... What's wrong with this piece of code ? ... program p1047(input,output); const MAX=3000; var n,i : integer; a0,a1,an1,S : real; c : array[1..MAX] of real; begin ReadLn(n); ReadLn(a0); ReadLn(an1); for i:=1 to n do ReadLn(c[i]); if n>1 then begin S:=c[1]+c[2]; i:=3; while i<=n do begin S:=S*2.0+c[i]; i:=i+1; end; a1:=(n*a0+an1-2.0*(S+c[1]))/(n+1); end else a1:=(a0+an1)/2.0-c[1]; WriteLn(a1:6:2); end. |
|
|