Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Help!!!!!!!why wrong answear?Thanks ^_^

Posted by zbw1987 at 2004-06-11 23:30:42 on Problem 1014
program aaa;
var a:array[1..6]of integer;
    tt:boolean;
    eee:array[1..10000]of boolean;
    may:array[1..10000,1..2]of integer;
    n:longint;
    total:longint;
procedure init;
var i,j:integer;
begin
tt:=false;                     total:=0;
for i:=1 to 6 do begin read(a[i]);
                        if a[i]<>0 then tt:=true;
                        total:=total+a[i]*i;
                 end;
end;
procedure work;
var i,j,p,q:integer;
    r:boolean;
procedure make(x,y:integer);
var g,h:integer;
begin
for g:= (y div x) downto 0 do
   if a[x]>=g then
          begin
          if y-x*g=0 then begin r:=true;break;end
                        else if x<6 then make(x+1,y-x*g);
          end;
end;
begin
r:=false;
if total mod 2=0 then
          begin
          i:=0;
          for p:=1 to 6 do
          if a[p] mod 2=1 then i:=i+p;
          make(1,i div 2);
          end;
eee[n]:=r;
end;
procedure outit;
var i,j:integer;
begin
for i:=1 to n-1 do
                        begin
writeln('Collection #',i,':');
if eee[i] then  writeln('Can be divided.')
     else writeln('Can','''','t be divided.');
     writeln;                 end;
end;
begin
n:=0;tt:=true;
while tt do
begin
  inc(n);
  init;
  if tt then work;
end;
outit;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator