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 1258. Pool

Saturn I think this problem is simple but I got WA#14 [1] // Problem 1258. Pool 2 Jul 2004 23:22
I think this problem is simple but I got WA#14.

var w,d:real;
    l:real;
    lx,ly,x0,y0,x1,y1:real;
    ch:char;
begin
        readln(w,d);
        readln(x0,y0);
        readln(x1,y1);
        lx:=x0-x1;
        ly:=y0-y1;
        while not eof do
        begin
                read(ch);
                case upcase(ch) of
                'L':lx:=lx+2*x1;
                'R':lx:=lx+2*(w-x1);
                'F':ly:=ly+2*y1;
                'B':ly:=ly+2*(d-y1);
                end;
        end;
        l:=sqrt(lx*lx+ly*ly);
        write(l:0:4);
end.
Oh AC now! Very stupid bug:)