|
|
back to boardCould anybody help me?My program always get WA! Here is my program: const inp='1190.txt'; var a:array[1..5000]of integer; max,min,n,i:integer; ans:longint; s:char; f:text; begin assign(f,inp);reset(f); readln(f,n);min:=10000;max:=0; for i:=1 to n do begin read(f,s); while s<>' ' do read(f,s); read(f,a[i]); if a[i]=1 then readln(f,a[i]) else readln(f); if a[i]<min then min:=a[i]; if a[i]>max then if max<>0 then begin writeln('NO');halt;end else max:=a[i]; end; close(f); ans:=0; for i:=1 to n do if a[i]=0 then ans:=ans+min else ans:=ans+a[i]; if ans<>10000 then begin ans:=0; for i:=1 to n do if a[i]=0 then ans:=ans+max else ans:=ans+a[i]; end else begin writeln('YES');halt;end; if ans=10000 then writeln('YES') else writeln('NO'); end. |
|
|