- 卡布列克圆舞曲
- 2009-03-04 13:15:44 @
program L1;
var
i,j,k,l,m,n,code:longint;
st:string;
procedure make(st:string);
var
i,j,k,l,m,n:longint;
a:array[1..10000] of longint;
ch:char;
x,y,z:longint;
function check(s,m:longint):boolean;
var
i,j:longint;
begin
check:=false;
for i:=1 to m-1 do
if s=a[i] then
begin
check:=true;
for j:=i to m-1 do write(a[j],' ');
writeln;
end;
end;
begin
fillchar(a,sizeof(a),0);
z:=1000;m:=0;l:=length(st);
while not check(z,m) do
begin
n:=length(st);
for i:=1 to n-1 do
for j:=i+1 to n do
if st[i]st[j] then
begin
ch:=st[i];st[i]:=st[j];st[j]:=ch;
end;
val(st,y,code);
z:=abs(x-y);
str(z,st);
inc(m);
a[m]:=z;
end;
end;
begin
while not(eof) do
begin
readln(st);
make(st);
end;
end.
0 条评论
目前还没有评论...