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.

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.

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;

}

uses crt;

const fi='tamgiac.dat';

var f1:text;

a,b,c:array[1..100]of real;

n,i,j,k,dem:integer;

begin

clrscr;

assign(f1,fi); reset(f1);

n:=0;

while not eof(f1) do 

  begin

inc(n);

readln(f1,a[n],b[n],c[n]);

end;

dem:=0;

for i:=1 to n do 

for j:=1 to n do 

for k:=1 to n do

if (i=j) and (j=k) then

begin

  if (a[i]+b[j]>c[k]) and (a[i]+c[k]>b[j]) and (c[k]+b[j]>a[i]) then

  begin

if (a[i]=b[j]) and (a[i]<>c[k]) and (b[j]<>c[k]) then inc(dem);

if (a[i]=c[k]) and (a[i]<>b[j]) and (c[k]<>b[j]) then inc(dem);

if (b[j]=c[k]) and (b[j]<>a[i]) and (c[k]<>a[i]) then inc(dem);

end;

end;

writeln(dem);

readln;

end.

12 tháng 5 2021

program du_lieu;

uses crt;

var i,n:integer;

a:array[1..100]of integer;

tbc:real;

f:text;

begin

clrscr;

assign(f,'DULIEU.INP');reset(f);

readln(f,n);

for i:=1 to n do

begin

read(f,a[i]);

end;

close(f);

for i:=1 to n do

tbc:=tbc+a[i];

writeln(tbc/n);

readln;

end.

uses crt;

const fi='dulieu.inp';

var f1:text;

a:array[1..100]of integer;

n,i,t1,t2:integer;

begin

clrscr;

assign(f1,fi); reset(f1);

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t1:=0;

t2:=0;

for i:=1 to n do 

 begin

if a[i]>0 then t1:=t1+a[i];

if a[i]<0 then t2:=t2+a[i];

end;

writeln('Tong cac so duong la: ',t1);

writeln('Tong cac so am la: ',t2);

close(f1);

readln;

end.