#include <iostream>
#include <iomanip
#include <cmath>
using namespace std;
double St(double x1, double y1, double x2, double y2)
{
return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
}
double Per(double a, double b, double c)
{
return a+b+c;
}
double S(double a, double b, double c)
{
double p2 = Per(a,b,c)/2;
return sqrt(p2*(p2-a)*(p2-b)*(p2-c));
}
int main()
{
double x1, y1, x2, y2, x3, y3;
double a, b, c, p, s;
cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;
a = St(x1,y1,x2,y2);
b = St(x1,y1,x3,y3);
c = St(x2,y2,x3,y3);
p = Per(a,b,c);
s = S(a,b,c);
cout.setf(std::ios::fixed);
cout.precision(6);
cout << "p = " << p << "\n";
cout << "s = " << s << "\n";
system("Pause");
return 0;
}
Пример:
1 1
4 1
1 5
<span>p = 12.000000
s = 6.000000</span>
Ответ:
Что за piton может Python
Объяснение:
Const n=20;
Var i, k:integer ;s:real ;
A:array [1..200]of Integer ;
Begin
S:=0;
For i:=1 to N do begin
Write(' ') ;
a[i]:=random(41)+150;
S:=s+a[i];
Writeln(' ', a[i]) ;
End;
S:=s/n;
For i:=1 to N do begin
If(a[i] >s) then k:=k+1;
End;
Writeln ( ' ', k) ;
End.