Pagini recente » Cod sursa (job #1136479) | Cod sursa (job #163631) | fminostress2012bun | Cod sursa (job #221325) | Cod sursa (job #308963)
Cod sursa(job #308963)
type multime=set of char;
var n,a,b,x,y,r,k,i:longint;
m:longint;
c:string;
ok:boolean;
l:multime;
begin
assign(input,'multiplu.in');reset(input);
assign(output,'multiplu.out');rewrite(output);
readln(a,b);
l:=['0','1'];
{x:=a;
y:=b;
r:=x mod y;
while r<>0 do
begin
x:=y;
y:=r;
r:=x mod y;
end;
m:=a*b div y;}
if a>b then m:=a else m:=b;
repeat
ok:=true;
k:=2;
str(m,c);
i:=1;
while c[i] in l do inc(i);
if i-1<>length(c) then ok:=false;
if ok then begin write(m); exit;end;
if not ok then
while (m*k mod 10<>1) do inc(k);
m:=m*k;
until ok;
close(input);close(output);
end.