|
|
back to boardwhat's wrong? on my pc it works right... (Pascal) Posted by jss94 14 Oct 2012 19:03 var n,i,k:byte; x,d,y:integer; m:array[0..100] of integer; begin read(n,x); for i:=1 to n do read(m[i]); k:=0; y:=n; if x<0 then begin for i:=1 to y do begin if (m[i]>x) and (m[i]<0) then begin writeln('Impossible'); k:=k+1;end else begin if m[i]<0 then begin y:=abs(x); end; if m[i]>0 then d:=m[i]; end; if m[i]<d then d:=m[i];end; writeln(d+d+abs(x)); writeln(y); end; if x>0 then begin for i:=1 to n do begin if (m[i]<x) and (m[i]>0) then begin writeln('Impossible'); k:=k+1;end else begin if (m[i]>x) and (m[i]>0) then begin d:=x; writeln(d);end; if m[i]<0 then d:=m[i];end; if (m[i]<0) and (m[i]>d) then d:=m[i]; end; writeln(abs(d)+abs(d)+x); end; end. |
|
|