Pagini recente » Cod sursa (job #2763487) | Cod sursa (job #2762214) | Cod sursa (job #1953949) | Cod sursa (job #2903047) | Cod sursa (job #125593)
Cod sursa(job #125593)
var f,g:text;
a,b,m,nr,x,y:int64;
i:longint;
{}
function ok(nr:int64):boolean;
var i:byte;
begin
ok:=true;
while nr <> 0 do begin
if nr mod 10 >1 then begin ok:=false; break; end;
nr:=nr div 10;
end;
end;
{}
begin
assign(f,'multiplu.in'); reset(f);
assign(g,'multiplu.out'); rewrite(g);
readln(f,a,b);
x:=a; y:=b;
while a <> b do
if a <b then a:=a+x else
b:=b+y;
nr:=a;
for i := 1 to 1000000 do
if ok(nr*i) then begin
writeln(g,nr*i);
break;
end;
close(f);
close(g);
end.