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 1302. Delta-wave

Complete Error???????????where?where?
Posted by wangchun 15 May 2004 20:49
var m,n,t,h,l,out:longint;
    as,bs:boolean;
procedure check;
var k,al,bl,ah,bh:longint;
begin
     k:=1;
     while sqr(k)<m do
           inc(k);
     ah:=k;
     k:=1;
     while sqr(k)<n do
           inc(k);
     bh:=k;
     h:=bh-ah;
     al:=sqr(ah)-m-ah+1;
     bl:=sqr(bh)-n-bh+1;
     l:=abs(al-bl);
     if odd(sqr(ah)-m) then
        as:=false
                       else
        as:=true;
     if odd(sqr(bh)-n) then
        bs:=false
                       else
        bs:=true;
end;
procedure make;
begin
     if as=bs then
        begin
             if l=0 then
                out:=h*2
                    else
                begin
                     if l<=h then
                        out:=2*h
                            else
                        begin
                             out:=l+h;
                        end;
                end;
        end
              else
        begin
             if as then
             begin
             if l>h then
                out:=l+h
                    else
                out:=2*(h-1)+l;
             end
                   else
             begin
             if l>h then
                out:=l+h
                    else
                out:=2*h+1;
             end;
        end;
     writeln(out);
end;
begin
     readln(m,n);
     if m>n then
        begin
             t:=m;
             m:=n;
             n:=t;
        end;
     check;
     make;
end.
Re: Complete Error???????????where?where?
Posted by zhizhiliu 11 Aug 2004 08:25
as is a reserved word.