2-B,1-z
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Type Tr = class
a, b, c:real;
Constructor create(a1, a2, a3:real);
function prav:boolean;
function pl:real;
end;
mas= array of Tr;
var
Form1: TForm1;
implementation
Constructor Tr.create(a1, a2, a3:real);
begin
a:=a1;
b:=a2;
c:=a3;
end;
function Tr.prav:boolean;
begin
prav:=false;
if (a=b) and (b=c)
then prav:=true;
end;
function Tr.pl:real;
var p:real;
begin
p:=(a+b+c) /2;
result:=sqrt(p*(p-a) *(p-b) *(p-c));
end;
{$R *.dfm}
var aa:mas; f, f1:textfile; n, l, i:integer;bb:array of boolean; k1, k2, k3:real;
cc:array of real; min:real;
procedure TForm1.Button1Click(Sender: TObject);
begin
assignfile(f, 'in.txt');
reset(f);
n:=0;
While not eof(f) do
begin
inc(n);
setlength(aa, n);
readln(f, k1, k2, k3);
aa[n-1]:=Tr.create(k1, k2, k3);
end;
closefile(f);
l:=0;
for i:=0 to n-1 do
if aa[i].prav=true
then inc(l);
min:=aa[0].pl;
for i:= 1 to n-1 do
if aa[i].pl<min
then min:=aa[i].pl;
Label3.Caption:=inttostr(l);
Label4.Caption:=floattostr(min);
end;
end.