unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> ListBox1: TListBox;<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>const<br> a: array [1..15] of Integer = (1, 5, 7, 8, 9, 10, 11, 13, 18, 24, 35, 45, 68, 69, 78);<br><br>{$R *.dfm}<br><br>procedure Hahaha;<br>var<br> Stack: array [1..3] of Integer;<br> Top: Integer;<br> i: Integer;<br> s: string;<br><br>function Double: Boolean;<br>var<br> i: Integer;<br>begin<br> Result:=False;<br> for i:=1 to Top-1 do<br> if Stack[Top]=Stack then<br> begin<br> Result:=True;<br> Exit<br> end<br>end;<br><br>begin<br> Top:=1;<br> Stack[Top]:=0;<br> while Top>0 do<br> begin<br> while Stack[Top]<15 do<br> begin<br> Inc(Stack[Top]);<br> if not Double then<br> begin<br> if Top=3 then<br> begin<br> s:=IntToStr(Stack[1]);<br> for i:=2 to 3 do<br> s:=s+'*'+IntToStr(Stack);<br> Form1.ListBox1.Items.Append(s)<br> end<br> else<br> begin<br> Inc(Top);<br> Stack[Top]:=0<br> end<br> end<br> end;<br> Dec(Top)<br> end<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> Hahaha<br>end;<br><br>end.<br>