blob: 5ebc179c36f400539d3d0ea24a101a58c95ad26b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
var
h, w, v, lcm: int64;
function gcd(a, b: int64): int64;
var
c: int64;
begin
while b > 0 do
begin
c := b;
b := a mod b;
a := c
end;
gcd := a
end;
begin
repeat
readln(h, w, v);
lcm := h * w div gcd(h, w);
if lcm div h mod 2 = 0 then
write('U')
else
write('L');
if lcm div w mod 2 = 0 then
write('L ')
else
write('R ');
write(lcm div h + lcm div w - 2);
writeln(' ', lcm div v)
until eof(input)
end.
|