测评机: Virmain[1]
得分: 100分 [我要评价一下题目~]
提交日期: 2013-10-29 19:35:00
有效耗时: 829毫秒
RQNOJ近期在线比赛列表
RQNOJ2013年十一月月赛 时间:2013-11-02 18:30:00 [报名]
测试结果1: 通过本测试点|有效耗时188ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时78ms
测试结果4: 通过本测试点|有效耗时78ms
测试结果5: 通过本测试点|有效耗时78ms
测试结果6: 通过本测试点|有效耗时79ms
测试结果7: 通过本测试点|有效耗时78ms
测试结果8: 通过本测试点|有效耗时78ms
测试结果9: 通过本测试点|有效耗时62ms
测试结果10: 通过本测试点|有效耗时63ms
提交代码: view sourceprint?01.type
type
arr=array[1..10] of real;
var
a:arr;
b:array[1..10] of boolean;
st,ch:string;
i,jg:integer;
procedure find(y:integer);
var
i,j:integer;
g:boolean;
begin
if abs(a[7]-24)<=0.0000001 then begin writeln('yes'); halt; end;
for i:=1 to y do
if b[i] then
for j:=i+1 to y do
if b[j] then
begin
b[i]:=false; b[j]:=false;
b[y+1]:=true;
a[y+1]:=a[i]+a[j];
find(y+1);
b[y+1]:=true;
a[y+1]:=abs(a[i]-a[j]);
find(y+1);
b[y+1]:=true;
a[y+1]:=a[i]*a[j];
find(y+1);
if (a[i]<>0) then
begin
b[y+1]:=true;
a[y+1]:=a[j]/a[i];
find(y+1);
end;
if (a[j]<>0) then
begin
b[y+1]:=true;
a[y+1]:=a[i]/a[j];
find(y+1)
end;
b[i]:=true; b[j]:=true;
end;
end;
begin
read(st);
i:=0;
while i<=4 do
begin
inc(i);
if i=4 then ch:=st
else ch:=copy(st,1,pos(' ',st)-1);
delete(st,1,pos(' ',st));
if ch='A'
then a[i]:=1
else if ch='J'
then a[i]:=11
else if ch='Q'
then a[i]:=12
else if ch='K'
then a[i]:=13
else val(ch,a[i]);
end;
fillchar(b,sizeof(b),false);
for i:=1 to 4 do b[i]:=true;
find(4);
writeln('no');
end.