Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
var xa,ya,xb,yb,xc,yc:integer;
ab,ac,bc,cv,p,s:real;
begin
clrscr;
write('Nhap toa do diem A:'); readln(xa,ya);
write('Nhap toa do diem B:'); readln(xb,yb);
write('Nhap toa do diem C:'); readln(xc,yc);
ab:=sqrt(sqr(xa-xb)+sqr(ya-yb));
ac:=sqrt(sqr(xa-xc)+sqr(ya-yc));
bc:=sqrt(sqr(xb-xc)+sqr(yb-yc));
if (ab+bc>ac) and (ab+ac>bc) and (ac+bc>ab) then
begin
cv:=ab+bc+ac;
p:=cv/2;
s:=sqrt(p*(p-ab)*(p-ac)*(p-bc));
writeln('Chu vi la: ',cv:4:2);
writeln('Dien tich la: ',dt:4:2);
kt:=0;
if (ab=ac) and (ab<>bc) and (ac<>bc) then kt:=1;
if (ac=bc) and (ac<>ab) and (bc<>ab) then kt:=1;
if (ab=bc) and (ab<>ac) and (bc<>ac) then kt:=1;
if (ab=ac) and (ac=bc) then kt:=2;
if sqr(ab)=sqr(ac)+sqr(bc) then kt:=3;
if sqr(ac)=sqr(ab)+sqr(bc) then kt:=3;
if sqr(bc)=sqr(ab)+sqr(ac) then kt:=3;
if kt=0 then writeln('Day la tam giac thuong');
if kt=1 then writeln('Day la tam giac can');
if kt=2 then writeln('Day la tam giac deu');
if kt=3 then writeln('Day la tam giac vuong');
end
else writeln('Day khong phai la toa do 3 dinh cua mot tam giac');
readln;
end.
const fi='tamgiac.dat';
fo='tamgiac.out';
var f1,f2:text;
a,b,c,d,e,f:array[1..100]of integer;
i,n,dem1,dem2,dem3:integer;
ab,bc,ac:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
readln(f1,a[i],b[i],c[i],d[i],e[i],f[i]);
dem1:=0;
dem2:=0;
dem3:=0;
for i:=1 to n do
begin
ab:=sqrt(sqr(a[i]-c[i])+sqr(b[i]-d[i]));
ac:=sqrt(sqr(a[i]-e[i])+sqr(b[i]-f[i]));
bc:=sqrt(sqr(c[i]-e[i])+sqr(d[i]-f[i]));
if (ab>0) and (ac>0) and (bc>0) and (ab+ac>bc) and (ab+bc>ac) and
(ac+bc>ab) then
begin
if (ab=ac) or (ac=bc) then inc(dem1);
if ((ab=ac) and (ab<>bc) and (ac<>bc)) then inc(dem2);
if ((ac=bc) and (bc<>ab) and (ac<>ab)) then inc(dem2);
if ((ac=bc) and (ac<>ab) and (bc<>ab)) then inc(dem2);
if sqr(ab)=sqr(ac)+sqr(bc) then inc(dem3);
if sqr(ac)=sqr(bc)+sqr(ab) then inc(dem3);
if sqr(bc)=sqr(ab)+sqr(ac) then inc(dem3);
end;
end;
writeln(f2,dem1);
writeln(f2,dem2);
writeln(f2,dem3);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
double xa,ya,xb,yb,xc,yc,ab,ac,bc;
int main()
{
cin>>xa>>ya>>xb>>yb>>xc>>yc;
ab=(sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)));
ac=(sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)));
bc=(sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)));
p=(ab+bc+ac)/2;
s=sqrt(p*(p-ab)*(p-ac)*(p-bc));
cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s<<endl;
cout<<"Duong cao ung voi dinh A la:"<<fixed<<setprecision(2)<<2*s/bc<<endl;
cout<<"Duong cao ung voi dinh B la:"<<fixed<<setprecision(2)<<2*s/ac<<endl;
cout<<"Duong cao ung voi dinh C la:"<<fixed<<setprecision(2)<<2*s/ab<<endl;
return 0;
}
uses crt;
var xa,ya,xb,yb,xc,yc,p,s,ab,ac,bc:real;
begin
clrscr;
write('Nhap toa do diem A:'); readln(xa,ya);
write('Nhap toa do diem B:'); readln(xb,yb);
write('Nhap toa do diem C:'); readln(xc,yc);
ab:=sqrt(sqr(xa-xb)+sqr(ya-yb));
ac:=sqrt(sqr(xa-xc)+sqr(ya-yc));
bc:=sqrt(sqr(xb-xc)+sqr(yb-yc));
p:=(ab+bc+ac)/2;
s:=sqrt(p*(p-ab)*(p-bc)*(p-ac));
writeln('Dien tich tam giac la: ',s:4:2);
readln;
end.
var ax,ay,bx,by,cx,cy,a,b,c : real;
begin
writeln('nhap toa do A', ax,ay);
writeln('nhap toa do B',bx,by);
writeln('nhap toa do C',cx,cy);
c:=sqrt(sqr(ax-bx) + sqr(ay-by));
b:=sqrt(sqr(ax-cx)+sqr(ay-cy));
a:=sqrt(sqr(bx-cx)+sqr(by-cy));
if (a+b>c) and (a+c>b) and (b+c>a) then write('Ba diem A,B,C tao thanh tam giac) else ('Ba dinh A,B,C khong tao thanh tam giac);
readln
end.
Giải thích : Sử dụng tọa độ để tính độ dài AB = c, AC = b, BC=a
Nếu tổng của 2 trong 3 số a,b,c lớn hơn số còn lại thì ta được tam giác, nếu không thì không tạo thành ta giác
#include <bits/stdc++.h>
using namespace std;
double ax,ay,bx,by,cx,cy,a,b,c;
int main()
{
cin>>ax>>ay>>bx>>by>>cx>>cy;
a=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
b=sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
c=sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
if (a+b>c && b+c>a && c+b>a) cout<<"Yes";
else cout<<"No";
return 0;
}