39 lines
629 B
ObjectPascal
39 lines
629 B
ObjectPascal
|
PROGRAM Hello;
|
||
|
|
||
|
VAR
|
||
|
filein : text;
|
||
|
mychar : char;
|
||
|
highest, column, row, pass : integer;
|
||
|
|
||
|
BEGIN
|
||
|
highest := 0;
|
||
|
column := 0;
|
||
|
row := 0;
|
||
|
|
||
|
assign(filein, 'input');
|
||
|
reset(filein);
|
||
|
repeat begin
|
||
|
read(filein, mychar);
|
||
|
|
||
|
case mychar of
|
||
|
'F': row := row shl 1;
|
||
|
'B': row := (row shl 1) or 1;
|
||
|
'L': column := column shl 1;
|
||
|
'R': column := (column shl 1) or 1;
|
||
|
otherwise begin
|
||
|
pass := row * 8 + column;
|
||
|
|
||
|
if pass > highest then
|
||
|
highest := pass;
|
||
|
|
||
|
row := 0;
|
||
|
column := 0;
|
||
|
end
|
||
|
end;
|
||
|
end;
|
||
|
until eof(filein);
|
||
|
close(filein);
|
||
|
|
||
|
writeln('Largest boarding pass found is ', highest);
|
||
|
END.
|