|
|
back to boardis it correct we get at #5 WA var a,c,b : array[1..10000]of longint; var n : longint; procedure sort(m,t:longint); var y,i,j,w:longint; begin i:=m;j:=t;y:=a[(m+t)div 2]; repeat while a[i]<y do inc(i); while a[j]>y do dec(j); if i<=j then begin w:=a[i];a[i]:=a[j];a[j]:=w; inc(i);dec(j); end; until i>j; if i<t then sort(i,t); if m<j then sort(m,j); end; PRocedure red; var i,j : longint; begin readln(n); for i:=1 to n do read(a[i]); sort(1,n); end; {=-=================} PRocedure get; var i,sum1,sum2 : longint; begin sum1:=a[n]; sum2:=0; for i:=n-1 downto 1 do begin if sum1>=sum2 then begin sum2:=sum2+a[i]; end else begin sum1:=sum1+a[i]; end; end; writeln(abs(sum1-sum2)); end; {=-=================} BEgin red; get; end. Re: is it correct we get at #5 WA Posted by Sid 3 Feb 2006 22:11 Try brudforce =) It realy works Re: is it correct we get at #5 WA What does brudforce mean,my english is poor Try brudforce =) It realy works Re: is it correct we get at #5 WA Bruteforce REALLY works in 0.14, 130K:)) 2Aybek_TKTL: bruteforce in this case is full search through all possible variants (if u are Russian, then полный перебор). Re: is it correct we get at #5 WA I have WA at #5 test too. |
|
|