|
|
вернуться в форумWA #5 Послано Swifty 16 мар 2009 19:15 var a:array [1..100] of integer; n,x,i,j,m,x1,x2,min1,min2:integer; begin readln(n,x); m:=0; min1:=maxint; min2:=maxint; for i:=1 to n do begin read(a[i]); if (a[i]>x)and(a[i]<0) then begin writeln('Impossible'); readln; halt; end; if (a[i]<x)and(a[i]>0) then begin writeln('Impossible'); readln; halt; end; if (a[i]>0)and(a[i]<min1) then begin min1:=a[i]; end; if (a[i]<0)and(a[i]<min2) then begin min2:=a[i]; end; end; if (x<0)and(min1=maxint) then begin writeln(abs(x),' ',abs(x)); readln; halt; end; if (x>0)and(min2=maxint) then begin writeln(abs(x),' ',abs(x)); readln; halt; end; if x<0 then begin x1:=(min1*2)+abs(x); x2:=abs(x); end; if x>0 then begin x1:=x; x2:=(abs(min2)*2)+x; end; if x=0 then begin x1:=0; x2:=0; end; writeln(x1,' ',x2); readln; end. I can't understand what is wrong here? Edited by author 16.03.2009 19:29 Re: WA #5 Послано Swifty 16 мар 2009 19:28 Can anyone give me some tests??? Re: WA #5 i can give you my ac solution |
|
|