- 分享
- 2009-06-14 21:20:51 @
var
a,b,n,len,i,j,p,q:longint;
s,f:string;
x,y:int64;
t:char;
ans:array[0..500] of int64;
wr:array[0..500] of dot;
judge:boolean;
procedure qs(h,t:longint);
var
i,j:longint;
x,y:char;
begin
i:=h;
j:=t;
x:=s[(i+j) shr 1];
repeat
while s[i]x do dec(j);
if ij;
if ih then qs(h,j);
end;
begin
repeat
inc(b);
s:='';
q:=0;
len:=0;
readln(s);
len:=length(s);
for i:=1 to len do
ans[i]:=0;
while true do
begin
f:='';
qs(1,len);
val(s,x);
for i:=1 to len do
f:=f+s[len+1-i];
val(f,y);
inc(q);
ans[q]:=y-x;
str(ans[q],s);
for i:=1 to q-1 do
if ans[i]=ans[q] then
begin
judge:=true;
p:=i-1;
wr[0]:=q-p-1;
for j:=1 to wr[0] do
wr[j]:=ans[p+j];
break;
end;
if judge then
begin
for j:=1 to wr[0] do
write(wr[j],' ');
writeln;
break;
end;
end;
until eof;
end.
能帮我找找程序里哪里有错误吗,它显示运行超时|格式错误...还有一个答案错误...
1 条评论
-
maa04 LV 10 @ 2009-06-14 21:20:51
超过10不没循环就直接判定无法循环啦
- 1