弱弱的闻声,第十个过了,其他的超时~~~!!

如题,神牛们帮我看看啊

var a,c,d,e,i,j,k,m,n,l:longint;

s,s1,s2,s3:string;

g:char;

b:array[0..10000]of longint;

function f(e:longint):boolean;

var k:integer;

begin

for k:=0 to n do if e=b[k] then begin f:=true;m:=k;break;end

else f:=false;

end;

begin

while not eof do begin

readln(a);

fillchar(b,sizeof(b),0);

e:=a;

n:=0;

str(a,s1);

l:=length(s1);

while not f(e) do begin

inc(n);b[n]:=e;

str(e,s);

while length(s)l do s:='0'+s;

s2:='';

for i:=1 to l-1 do

for j:=i to l do begin

if s[i]>s[j] then begin

g:=s[i];

s[i]:=s[j];

s[j]:=g;

end;

end;

for i:=1 to l do begin

s2:=s2+s[l-i+1];

end;

val(s,c);

val(s2,d);

e:=d-c;

end;

for i:=m to n-1 do write(b[i],' ');

write(b[n]);

end;

end.

1 条评论

  • 1

信息

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