Много лишнего(наверно), только с олимпиады!Как есть. uses crt; var b,n,i,k,c,o,x1:integer; f,s,ch:string; r,g: text; A:array [0..9] of integer; begin assign (r,'C:\Bin.txt'); reset (r); readln (r,f); close (r); for i:=1 to length(f) do begin s:=copy(f,1,1); if (s<>'0') or (s<>'1') or (s<>'2') or (s<>'3') or (s<>'4') or (s<>'5') or (s<>'6') or (s<>'7') or (s<>'8') or (s<>'9')then delete(f,1,1); if (s='0') or (s='1') or (s='2') or (s='3') or (s='4') or (s='5') or (s='6') or (s='7') or (s='8') or (s='9')then begin x1:=pos(s,ch); if x1<>0 then begin delete(ch,x1,1); ch:=ch+s; end else ch:=ch+s; end; end; val(ch,n,o); N := Abs(N); for i := 0 to 9 do A[ i ] := 0; while N > 0 do begin Inc(A[ N mod 10]); N := N div 10; end; assign (g,'C:\Bout.txt'); rewrite (g); for i := 0 to 9 do while A[ i ] > 0 do begin Write(g,i); Dec(A[ i ]); end; close(g); end.
Начнем с формул. Площадь треугольника: S = 1/2*a*b*sin C Отсюда: sin C = 2*S/(a*b); cos C = sqrt(1 - sin^2 C) tg C = sin C / cos C; C = atan(tg C) Теорема косинусов: c = sqrt(a^2 + b^2 - 2*a*b*cos C) Площадь: S = c*h/2; отсюда h = 2*S/c Теорема синусов: a/sin A = b/sin B = c/sin C Отсюда: sin A = a/c*sin C; sin B = b/c*sin C cos A = sqrt(1 - sin^2 A); cos B = sqrt(1 - sin^2 B) tg A = sin A/cos A; A = atan(tg A); tg B = sin B/cos B; B = atan(tg B) Периметр: P = a + b + c Теперь записываем в Паскале singam := 2*S/(a*b); cosgam = sqrt(1 - singam*singam); tangam := singam/cosgam; Gamma := atan(tangam); c := sqrt(a*a + b*b - 2*a*b*cosgam); h := 2*S/c; P := a + b + c; sinalp = a/c*singam; cosalp = sqrt(1 - sinalp*sinalp); tanalp := sinalp/cosalp; Alpha := atan(tanalp); sinbet = b/c*singam; cosbet = sqrt(1 - sinbet*sinbet); tanbet := sinbet/cosbet; Beta := atan(tanbet);
uses crt;
var b,n,i,k,c,o,x1:integer;
f,s,ch:string;
r,g: text;
A:array [0..9] of integer;
begin
assign (r,'C:\Bin.txt');
reset (r);
readln (r,f);
close (r);
for i:=1 to length(f) do
begin
s:=copy(f,1,1);
if (s<>'0') or (s<>'1') or (s<>'2') or (s<>'3') or (s<>'4') or (s<>'5') or (s<>'6') or (s<>'7') or (s<>'8') or (s<>'9')then
delete(f,1,1);
if (s='0') or (s='1') or (s='2') or (s='3') or (s='4') or (s='5') or (s='6') or (s='7') or (s='8') or (s='9')then
begin
x1:=pos(s,ch);
if x1<>0 then
begin
delete(ch,x1,1);
ch:=ch+s;
end
else
ch:=ch+s;
end;
end;
val(ch,n,o);
N := Abs(N);
for i := 0 to 9 do
A[ i ] := 0;
while N > 0 do
begin Inc(A[ N mod 10]);
N := N div 10;
end;
assign (g,'C:\Bout.txt');
rewrite (g);
for i := 0 to 9 do
while A[ i ] > 0 do
begin Write(g,i);
Dec(A[ i ]);
end;
close(g);
end.
Площадь треугольника: S = 1/2*a*b*sin C
Отсюда: sin C = 2*S/(a*b); cos C = sqrt(1 - sin^2 C)
tg C = sin C / cos C; C = atan(tg C)
Теорема косинусов: c = sqrt(a^2 + b^2 - 2*a*b*cos C)
Площадь: S = c*h/2; отсюда h = 2*S/c
Теорема синусов: a/sin A = b/sin B = c/sin C
Отсюда: sin A = a/c*sin C; sin B = b/c*sin C
cos A = sqrt(1 - sin^2 A); cos B = sqrt(1 - sin^2 B)
tg A = sin A/cos A; A = atan(tg A);
tg B = sin B/cos B; B = atan(tg B)
Периметр: P = a + b + c
Теперь записываем в Паскале
singam := 2*S/(a*b); cosgam = sqrt(1 - singam*singam);
tangam := singam/cosgam; Gamma := atan(tangam);
c := sqrt(a*a + b*b - 2*a*b*cosgam); h := 2*S/c;
P := a + b + c;
sinalp = a/c*singam; cosalp = sqrt(1 - sinalp*sinalp);
tanalp := sinalp/cosalp; Alpha := atan(tanalp);
sinbet = b/c*singam; cosbet = sqrt(1 - sinbet*sinbet);
tanbet := sinbet/cosbet; Beta := atan(tanbet);