|
|
вернуться в форумPlease HELP!!! Послано Serg 17 май 2007 01:27 Please HELP!!! Why WA on test 1??? program Project_kamni; {$APPtype CONSOLE} uses SysUtils; var s1,s2:string; m:array[1..101]of int64; a,b,t,n,j,k,r:int64; i:longint; begin readln(n); s1:=''; s2:=''; for i:=1 to n do begin readln(m[i]); s1:=s1+'0'; s2:=s2+'1' end; t:=992147483645; while s1<>s2 do begin i:=length(s1); while (s1[i]='1') do begin s1[i]:='0'; dec(i); end; s1[i]:='1'; a:=0; b:=0; for i:=1 to n do begin if s1[i]='1' then a:=a+m[i] else b:=b+m[i]; end; r:=abs(a-b); if r<t then t:=r; end; writeln(t); end. Why you have WA1? Послано BAron 17 июн 2007 11:02 Please write the test which there did not pass your program. Please help!!!!!!!!!!!! I dont know, why I have WA1 Re: Why you have WA1? test: 3 2 4 5 you must use read instead of readln Re: Why you have WA1? Послано BAron 19 июн 2007 11:36 Thanx |
|
|