Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求助!!为何总是WAvar a:array[1..6]of integer; ok:boolean; time,i:integer; f:boolean; procedure out; begin writeln('Collection #',time,':'); if ok then begin writeln('Can be divided.');writeln end else begin writeln('Can''t be divided.');writeln end end; procedure main; var i,j,total,t:integer; b:array[1..20000]of integer; r:array[0..120000]of boolean; begin total:=0; for i:=1 to 6 do inc(total,i*a[i]); if total mod 2<>0 then begin ok:=false;exit end; fillchar(b,sizeof(b),0); fillchar(r,sizeof(r),false); r[0]:=true; t:=0; for i:=1 to 6 do while a[i]>0 do begin inc(t); b[t]:=i; dec(a[i]) end; for i:=1 to t do for j:=total div 2 downto 1 do if j-b[i]>=0 then if (r[j])or(r[j-b[i]]) then r[j]:=true; if r[total div 2] then ok:=true else ok:=false end; begin // assign(input,'input.txt'); // reset(input); time:=0; repeat f:=false; for i:=1 to 6 do begin read(a[i]); if a[i]<>0 then f:=true end; if not f then halt; inc(time); main; out; until false end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator