compages.pas
来自「PASCAL光盘资料PASCAL光盘资料PASCAL光盘资料」· PAS 代码 · 共 36 行
PAS
36 行
program E1_7; {compages}
const maxn=20;
var i,j,n,r:integer;
a:array [0..maxn] of integer;
input,output:text;
begin
assign(input,'compages.in');
assign(output,'compages.out');
reset(input);
readln(input,n,r);
close(input);
rewrite(output);
for i:=0 to r do a[i]:=i;
i:=0;
while a[0]=0 do
begin
if a[i]-i<=n-r then
if i=r then
begin
for j:=1 to r do write(output,a[j]:3);
writeln(output);
a[i]:=a[i]+1
end
else begin
i:=i+1;
a[i]:=a[i-1]+1
end
else if i>0 then
begin
i:=i-1;
a[i]:=a[i]+1
end
end;
close(output);
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?