|
|
back to boardPlease where is a mistake? WA at time 0.26 program abc; var i,kol,p,sum,j,a,dop:longint; c:integer; s:string; ans,pr:boolean; mass:array[1..5000] of integer; begin readln(kol); for i:=1 to kol do begin readln(s); p:=pos(' ',s); delete(s,1,p); val(s,mass[i],c); if c>0 then begin p:=pos(' ',s); delete(s,1,p); val(s,a,c); mass[i]:=a; end; end; {end} sum:=0; for i:=1 to kol do begin if mass[i]>0 then begin j:=i-1; while mass[j]=0 do begin mass[j]:=mass[i]; j:=j-1; end; end; end; for i:=1 to kol do sum:=sum+mass[i]; if sum>10000 then writeln('NO') else writeln('YES'); end. - this is the program text. all my tests work properly. please, help!! Here it is Posted by WAZZAP 30 Mar 2002 17:01 3 b 1 33 c 1 34 d 0 YES should be NO, because of descending order. it is stilll WA > > 3 > b 1 33 > c 1 34 > d 0 > > YES > > should be NO, because of descending order. This is an invalid test. The trick is that if the max sum of all the components is less than 10000, it's a lie. |
|
|