求大牛改错-。-

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 条评论

  • 1

信息

ID
1024
难度
6
分类
模拟 点击显示
标签
(无)
递交数
6785
已通过
1570
通过率
23%
被复制
15
上传者