Pagini recente » Cod sursa (job #1917631) | Cod sursa (job #3175757) | Cod sursa (job #2305775) | Cod sursa (job #1860157) | Cod sursa (job #115353)
Cod sursa(job #115353)
var a,b,c,d,i,x,y,k:longint;
ok:boolean;
f,g:text;
begin
assign(f,'multiplu.in');
reset(f);
read(f,a);
readln(f,b);
close(f);
if b>a then begin
a:=a+b;
b:=a-b;
a:=a-b;
end;
x:=a;
repeat
x:=x div 10;
inc(k);
until x=0;
x:=1;
y:=1;
for i:=1 to k do begin
x:=x*10;
y:=y*10 +1;
end;
c:=a;
repeat
ok:=false;
if (c>x)and(c<y) then
if c mod b =0 then begin
d:=c;
ok:=true;
repeat
if (d mod 10)>1 then ok:=false;
d:=d div 10;
until d=0;
end;
if ok=false then begin
x:=x*10;
y:=y*10+1;
repeat
c:=c+a;
until c>=x;
end;
until (ok=true)or(c>100000000);
assign(g,'multiplu.out');
rewrite(g);
write(g,c);
close(g);
end.