...implementationuses Math;var PAI:array[1..5] of Integer;const cZH:array[1..8,1..3] of Integer= ( (1,2,3), (1,2,4), (1,3,4), (1,3,5), (2,3,4), (2,3,5), (2,4,5), (3,4,5) );procedure PaiXu;var i,j,k:integer;begin for i:=1 to 4 do for j:=1 to 4 do begin if PAI[j]>PAI[j+1] then begin k:=PAI[j]
PAI[j]:=PAI[j+1]
PAI[j+1]:=k
end
end;end;function CheckNiu(var value:Integer):Boolean;var i:Integer
TmpPAI:array[1..5] of Integer;begin result:=True
value:=-1
for i:=1 to 8 do if (PAI[cZH[1]]+PAI[cZH[2]]+PAI[cZH[3]]) mod 10=0 then begin Move(PAI,TmpPAI,5*SizeOf(Integer))
TmpPAI[cZH[1]]:=0
TmpPAI[cZH[2]]:=0
TmpPAI[cZH[3]]:=0
value:=(TmpPAI[1]+TmpPAI[2]+TmpPAI[3]+TmpPAI[4]+TmpPAI[5]) mod 10
exit
end
if ((PAI[1]=PAI[2]) and (PAI[1]=PAI[3]) and (PAI[1]=PAI[4])) or ((PAI[2]=PAI[3]) and (PAI[2]=PAI[4]) and (PAI[2]=PAI[5])) then begin value:=-PAI[2]
exit
end
result:=False;end;procedure TForm1.Button1Click(Sender: TObject);var i:Integer;begin for i:=1 to 5 do PAI:=StrToInt(edit1.Text)
PaiXu
if CheckNiu(i) then begin if i=0 then edit2.Text:='牛牛' else if i<0 then edit2.Text:='炸弹'+IntToStr(-i) else edit2.Text:='牛'+inttostr(i)
end else edit2.Text:='无牛,'+IntToStr(PAI[5])+'最大';end;没有考虑3张牌相同的情况,也没有考虑10以上的牌,只是符合楼主的要求,不符合真正的斗牛规则