K
Khách

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.

18 tháng 10 2021

#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;

}

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.

21 tháng 2 2023

Giúp mình ý tưởng bài đỉnh đồi pascal

 

21 tháng 2 2023

Cho mình ý tưởng bài này với!loading...  

uses crt;

var a,b,c:real;

begin

clrscr;

readln(a,b,c);

if (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) then 

begin

if (a=b) and (b=c) then write('Day la tam giac deu')

else writeln('Day khong la tam giac deu');

end

else writeln('Day khong la ba canh trong mot tam giac');

readln;

end.