var a,x:array[1..200] of longint;
n,k,d,s:longint;
procedure tim_uoc;
var i:longint;
begin
d:=1;a[d]:=k;
for i:=2 to trunc(sqrt(k)) do
begin
if k mod i=0 then
begin
inc(d);a[d]:=i;
inc(d);a[d]:=k div i;
end;
end;
if sqrt(k)=trunc(sqrt(k)) then dec(d);
end;
procedure xuat(k:longint);
var i:longint;
begin
for i:=1 to k do
if x[i]>0 then
writeln(a[i],' ',x[i]);
end;
procedure vet(i:longint);
var j:longint;
begin
for j:=0 to (n-s) div a[i] do
begin
x[i]:=j;
s:=s+j*a[i];
if (i=d) or (s>=n) then
begin
if s=n then
begin
xuat(i);
halt
end;
end
else
vet(i+1);
s:=s-j*a[i];
end;
end;
begin
assign(input,'phantich.inp');reset(input);
assign(output,'phantich.out');rewrite(output);
read(n,k);
tim_uoc;
vet(1);
writeln(0);
end.
* Chuyên dạy lập trình ONLINE cho học sinh THCS, THPT *.
Mọi giao lưu, trao đổi, xin liên hệ: Lê Quang Vinh - zalo: 037.803.8755.
Page: Lớp học Code Sky
Group FB1: Ôn thi HSG9 - THTB - TS10 chuyên tin
Group FB2: Học Scratch - Ôn thi Tin học trẻ bảng A
Thứ Bảy, 4 tháng 12, 2021
phantich pascal
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét
Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.