麻烦大神看下哪里错了

var
x,y,n,i,j,bs:longint;
s,m:string;
a:array[1..100] of longint;
function hws(e:longint):boolean;
var
bj,i:longint;
begin
bj:=0;
for i:=1 to e do
if a[i]<>a[e-i+1]
then bj:=1;
if bj=0
then hws:=true
else hws:=false;
end;
begin
readln(n); readln(m);
x:=length(m);
for i:=x downto 1 do
case m[i] of
'0'..'9':a[x-i+1]:=ord(m[i])-48;
'A'..'F':a[x-i+1]:=ord(m[i])-55;
end;
bs:=0;
while not hws(x) do
begin
for i:=1 to x do
begin
a[i]:=a[i]+a[x-i+1];
a[i+1]:=a[i+1]+(a[i] div n);
a[i]:=a[i] mod n;
end;
if a[x+1]<>0
then inc(x);
inc(bs);
if bs>30
then break;
end;
if bs<=30
then writeln('STEP=',bs)
else writeln('Impossible');
end.

1 条评论

  • 1

信息

ID
1304
难度
5
分类
模拟 点击显示
标签
递交数
8080
已通过
2532
通过率
31%
被复制
31
上传者