为什么错?

var jz,cf,cs,tem,ln,hw1,hw2,hwh1,hwh2,jzs:qword;

st,shw1,shw2,shwh1,shwh2:ansistring;

t:boolean;

i:longint;

c1:integer;

begin

readln(jz);

readln(st);

ln:=length(st);cf:=1;val(st[ln],jzs,c1);

for i:=ln-1 downto 1 do

begin

if st[i] in ['1'..'9'] then val(st[i],tem,c1);

if st[i] in ['A'..'J'] then tem:=ord(st[i])-55;

cf:=cf*jz;

tem:=tem*cf;

jzs:=jzs+tem;

end;

str(jzs,shw1);

ln:=length(shw1);

repeat

inc(cs);t:=false;

for i:=1 to ln do

shw2:=shw1[i]+shw2;

val(shw1,hw1,c1);

val(shw2,hw2,c1);

hwh1:=hw1+hw2;

str(hwh1,shwh1);

ln:=length(shwh1);

for i:=1 to ln do

shwh2:=shwh1[i]+shwh2;

val(shwh2,hwh2,c1);

if hwh1=hwh2 then t:=true;

shw1:='';shw2:='';shwh2:='';shwh1:='';

hw1:=hwh1;str(hw1,shw1);

until (cs>30) or (t=true);

if cs>30 then writeln('Impossible!')

else writeln('STEP=',cs);

end.

各位大牛,中牛,小牛,蜗牛

帮忙看看...

0 条评论

目前还没有评论...

信息

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