- 卡布列克圆舞曲
- 2012-08-15 10:58:57 @
var
n:array[1..10000] of longint;
f,k:longint;
procedure reverse(var k:longint);
var
s,ss:string;
f,len,t:longint;
begin
str(k,s);
len:=length(s);
t:=1;
for f:=len downto 1 do
begin
ss[t]:=s[f];
inc(t);
end;
val(ss,k);
end;
procedure find(n:longint);
var
min:array[1..1000] of longint;
x,f,ff,len:longint;
s,ss:string;
begin
min[1]:=0;
min[2]:=n;
x:=3;
while true do
begin
min[x]:=abs(min[x-1]-reverse(min[x-1]));
str(n,ss);
str(min[x],s);
len:=length(ss);
if length(s)len then
for f:=1 to (len-length(s)) do
insert('0',s,1);
val(s,min[x]);
for f:=2 to x-1 do
if min[x]=min[f] then
begin
for ff:=f to x-1 do
write(min[ff],' ');
writeln;
exit;
end;
end;
end;
begin
k:=1;
while not eof do
begin
readln(n[k]);
inc(k);
end;
for f:=1 to k do
find(n[f]);
end.
1 条评论
-
孤城中的歌谣 LV 5 @ 2012-08-17 10:56:04
你不报题号谁知道
那题啊
- 1