Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<iomanip>
- #include<string>
- #include<stdio.h>
- #define PI 3.141592653589793238
- struct TamGiac{
- double AB;
- double BC;
- double AC;
- };
- double DoDaiCanh(double a, double b, double c, double d){
- double x = sqrt(pow(c-a,2)+pow(d-b,2));
- return x;
- }
- int TamGiac(double a, double b, double c){
- if((a+b)<c||(b+c)<a||(a+c)<b){
- return 0;
- }
- return 1;
- }
- using namespace std;
- int main() {
- int t;
- cin >> t;
- while(t--){
- struct TamGiac tg;
- double xa, ya, xb, yb, xc, yc;
- cin >> xa >> ya >> xb >> yb >> xc >> yc;
- tg.AB = DoDaiCanh(xa, ya, xb, yc);
- tg.AC = DoDaiCanh(xa, ya, xc, yc);
- tg.BC = DoDaiCanh(xb, yb, xc, yc);
- if(TamGiac(tg.AB, tg.AC, tg.BC)==1){
- double DienTich = (1/4)*sqrt((tg.BC+tg.AC+tg.AB)*(tg.BC+tg.AC-tg.AB)*(tg.AC+tg.AB-tg.BC)*(tg.AB+tg.BC-tg.AC));
- double Ketqua = (tg.BC*tg.AC*tg.AB)/(4*DienTich);
- cout << fixed << setprecision(3) << tg.AB << " " << tg.AC << " " << tg.BC << endl;
- }else{
- cout << "INVALID" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement