program P74;
var
a:array[1..3] of integer;
b:array[1..4] of integer;
i,dir,cd:integer;
st,ch:string;
s:boolean;
{procedure check;
var
i:integer;
begin
for i:=1 to 3 do begin
write(b[i]);
case a[i] of
1:write('+');
2:write('-');
3:write('*');
4:write('/');
end;
end;
writeln(b[4]);
end;}
function sum(x:integer):boolean;
var
c:array[1..4] of real;
d:array[1..3] of integer;
i,j,cha:integer;
boo{,btest}:boolean;
begin
cha:=0;
boo:=false;
{btest:=true;}
for i:=1 to 4 do
c[i]:=b[i];
for i:=1 to 3 do
d[i]:=a[i];
{for i:=1 to 3 do
if d[i]<>3 then btest:=false;
if btest=true then begin
btest:=false;
end;}
for i:=1 to 3 do
if d[i-cha]>=3 then begin
if d[i-cha]=3 then c[i-cha]:=c[i-cha]*c[i-cha+1];
if d[i-cha]=4 then
if c[i-cha+1]<>0 then c[i-cha]:=c[i-cha]/c[i-cha+1]
else exit(false);
for j:=i-cha+1 to 3 do
c[j]:=c[j+1];
c[4-cha]:=0;
for j:=i-cha to 2 do
d[j]:=d[j+1];
d[3-cha]:=0;
inc(cha);
end;
cha:=0;
for i:=1 to 3 do
if d[i-cha]<=2 then begin
if d[i-cha]=1 then c[i-cha]:=c[i-cha]+c[i-cha+1];
if d[i-cha]=2 then c[i-cha]:=c[i-cha]-c[i-cha+1];
for j:=i-cha+1 to 3 do
c[j]:=c[j+1];
c[4-cha]:=0;
for j:=i-cha to 2 do
d[j]:=d[j+1];
d[3-cha]:=0;
inc(cha);
end;
if c[1]=24 then boo:=true;
exit(boo);
end;
procedure try(x:integer);
var
i:integer;
begin
for i:=1 to 4 do begin
a[x]:=i;
if (x=3) then
if sum(0) then begin
s:=true;
{check;}
end
else
else try(x+1)
end;
end;
begin
readln(st);
st:=upcase(st)+' ';
for i:=1 to 4 do begin
dir:=pos(' ',st);
ch:=copy(st,1,dir-1);
if ch='A' then b[i]:=1
else if ch='J' then b[i]:=11
else if ch='Q' then b[i]:=12
else if ch='K' then b[i]:=13
else val(ch,b[i],cd);
delete(st,1,dir);
end;
s:=false;
try(1);
if s then writeln('yes')
else writeln('no');
end.
上面的程序,我用学校与家的FP编译器已经编译通过了,但用RQNOJ编译总是出现那晦气的CE。Why?