ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1021. Sacrament of the Sum

Why error?Test number 3
Posted by Pavel 25 Jun 2008 21:05
Code:
var
i,l,a,b,max,z,d:integer;
otvet:string;
x,y:array[1..50000]of integer;
bo:boolean;
begin
bo:=true;
readln(a);
if (a>=1)and(a<=50000) then
begin
for i:=1 to a do
begin
readln(x[i]);
end;
readln(b);
for i:=1 to b do
begin
readln(y[i]);
end;
if a>b then max:=a;
if b>a then max:=b;
for i:=1 to max do
begin
if bo=true then
begin
for l:=1 to max do
begin
z:=x[i]+y[l];
if z=10000 then
begin
d:=1;
bo:=false;
end;
end;
end;
end;
if d=1 then otvet:='YES'
else otvet:='NO';
write(otvet);
end;
end.
BECAUSE ERROR?
Re: Why error?Test number 3
Posted by Alexander Babenko Kyr-Rus Slav U 20 Jul 2008 14:50
Because you are must use
if a>=b then max:=a;
if b>a then max:=b;