80分求初一学生一道pascal题,高手来,

来源:百度知道 编辑:UC知道 时间:2024/05/20 14:30:31
在这上面有三十分,我发出地方了,两边加起来就80分了。呵呵http://zhidao.baidu.com/question/53559908.html

var a,b,c,d,e,f,g,h,i,j,k,m,n:longint;
begin
for a:=1 to 4 do
for b:=1 to 4 do
for c:=1 to 4 do
for d:=1 to 4 do
if (a*b*c*d=24)and((a=1)or(b=1)or(c=1)or(d=1))(判断有无重复) then
begin
if ord(d=4)=1 then if (a<>1)or(b<>2) then continue;
if ord(b=3)=1 then if (a<>2)and(d<>2) then continue;
if ord(a<>1)=1 then if (a<>3)and(d<>3)then continue;
if ord(c=2)=1 then if (a<>4)and(d<>4) then continue;(对条件进行判断)
if ord(d=4)+ord(b=3)+ord(a<>1)+ord(c=2)<>2 then continue;(总共只有两个人对)
writeln(a,b,c,d);
end;
end.

逻辑判断题,答案是错不了的,步骤你检验一下吧
说明一下,a,b,c,d分别是数学,物理,化学,外语第一名的编号,甲是1,乙是2,丙是3,丁是4