9 solutions

  • 3
    @ 2023-9-16 22:15:09
    //我的最简洁
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
    	double x1,x2,x3,y1,y2,y3,a,b,c,t;
    	cin>>x1>>y1>>x2>>y2>>x3>>y3;
    	a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); 
    	b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); 
    	c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)); 
    	t=(a+b+c)/2;
    	cout << fixed << setprecision(2)<<sqrt(t*(t-a)*(t-b)*(t-c));
    	return 0;
    }
    
    • 1
      @ 2024-7-9 19:45:44
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
      	double x1,x2,x3,y1,y2,y3,a,b,c,t;
      	cin>>x1>>y1>>x2>>y2>>x3>>y3;
      	a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); 
      	b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); 
      	c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)); 
      	t=(a+b+c)/2;
      	cout << fixed << setprecision(2)<<sqrt(t*(t-a)*(t-b)*(t-c));
      	return 0;
      }
      
      • 1
        @ 2024-6-20 13:57:17
        #include <bits/stdc++.h>
        using namespace std;
        int main(){
        	double x1,x2,x3,y1,y2,y3,a,b,c,t;
        	cin>>x1>>y1>>x2>>y2>>x3>>y3;
        	a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); 
        	b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); 
        	c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)); 
        	t=(a+b+c)/2;
        	cout << fixed << setprecision(2)<<sqrt(t*(t-a)*(t-b)*(t-c));
        	return 0;
        }
        

        水题!

        • 1
          @ 2023-10-3 19:56:35
          #include <bits/stdc++.h>
          using namespace std;
          double x1,x2,y1,y2,x3,y3,t;
          int main(){
          	cin>>xa>>ya>>xb>>yb;
          	double an=sqrt(x1*x1+y1*y1);
               double ban=sqrt(x2*x2+y2*y2);
               double can=sqrt(x3*x3+y3*y3);
               double t=(an+ban+can)*1.0/2  
               	cout<<fixed<<setprecision(2)<<t<<endl;
          	return 0;
          
          • 0
            @ 2023-9-19 19:21:28
            #include <bits/stdc++.h>
            using namespace std;
            int main(int argc, char **argv){
            	double x1,x2,x3,y1,y2,y3,r,x,y,z;
            	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
            	x = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); 
            	y = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)); 
            	z = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)); 
            	r = (x + y + z) / 2;
            	printf("%.2f",sqrt(r * (r - x) * (r - y) * (r - z)));
            	return 0;
            }
            
            • 0
              @ 2023-9-10 17:27:02
              #include <set>
              #include <ios>
              #include <list>
              #include <cmath>
              #include <ctime>
              #include <queue>
              #include <deque>
              #include <stack>
              #include <vector>
              #include <bitset>
              #include <cctype>
              #include <cerrno>
              #include <cwchar>
              #include <cstdio>
              #include <fenv.h>
              #include <iosfwd>
              #include <string>
              #include <limits>
              #include <math.h>
              #include <cstdlib>
              #include <iomanip>
              #include <clocale>
              #include <complex>
              #include <cstring>
              #include <cstring>
              #include <cwctype>
              #include <istream>
              #include <ostream>
              #include <sstream>
              #include <fstream>
              #include <utility>
              #include <stdio.h>
              #include <iostream>
              #include <stdint.h>
              #include <string.h>
              #include <tgmath.h>
              #include <complex.h>
              #include <algorithm>
              #include <exception>
              #include <stdbool.h>
              #include <stdexcept>
              #include <streambuf>
              #include <functional>
              #include <inttypes.h>
              #include <bits/stdc++.h>
              using namespace std;
              int main(){
              	double x1,x2,x3,y1,y2,y3,a,b,c,t;
              	cin>>x1>>y1>>x2>>y2>>x3>>y3;
              	a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); 
              	b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); 
              	c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)); 
              	t=(a+b+c)/2;
              	cout << fixed << setprecision(2)<<sqrt(t*(t-a)*(t-b)*(t-c));
              	return 0;
              }
              
              
              • 0
                @ 2023-9-10 13:41:10

                #include<bits/stdc++.h> using namespace std; int main(){ double x1,x2,y1,y2,x3,y3; double ch1=0,ku1=0,ch2=0,ku2=0; double smj=0,djs1=0,djs2=0,djs3=0; double ch3=0,ku3=0,bzc=0; double pj1=0,pj2=0,pj3=0; scanf("%lf%lf",&x1,&y1); scanf("%lf%lf",&x3,&y3); scanf("%lf%lf",&x2,&y2); ch1=y3-y2; ch2=y3-y1; ch3=y2-y1; ku1=x2-x1; ku2=x3-x2; ku3=x3-x1; if(ch1<0){ ch1=0-ch1; } if(ku1<0){ ku1=0-ku1; } if(ch2<0){ ch2=0-ch2; } if(ch3<0){ ch3=0-ch3; } if(ku2<0){ ku2=0-ku2; } if(ku3<0){ ku3=0-ku3; } djs1=sqrt(ch1ch1+ku1ku1); djs2=sqrt(ch2ch2+ku2ku2); djs3=sqrt(ch3ch3+ku3ku3); bzc=(djs1+djs2+djs3)/2; pj1=bzc-djs1; pj2=bzc-djs2; pj3=bzc-djs3; smj=sqrt(bzcpj1pj2*pj3); cout<<fixed<<setprecision(2)<<smj; return 0; } 哪位大佬能看出那里错了

              • -1
                @ 2023-10-4 9:37:43

                #include <bits/stdc++.h> using namespace std;

                int main(){ double x1,x2,x3,y1,y2,y3,t; cin>>x1>>y1>>x2>>y2>>x3>>y3; double an=sqrt((x1-x2)(x1-x2)+(y1-y2)(y1-y2)); double ban=sqrt((x2-x3)(x2-x3)+(y2-y3)(y2-y3)); double can=sqrt((x3-x1)(x3-x1)+(y1-y3)(y1-y3)); t=(an+ban+can)1.0/2 ;吵 cout<<fixed<<setprecision(2)<<sqrt(t(t-an)(t-ban)(t-can))<<endl;查查查 return 0; }

                • -2
                  @ 2024-7-9 16:54:37
                  #include <iostream>
                  #include <iomanip>
                  #include <cmath>
                  using namespace std;
                  int main() {
                      double xa,ya,xb,yb,xc,yc,a,b,c,d,e,f,g,h,i,j,t,k,l,m;
                      cin>>xa>>ya>>xb>>yb>>xc>>yc;
                      a=xb-xa;
                      b=yb-ya;
                      c=sqrt(a*a+b*b);//勾股定理求a
                      d=xc-xb;
                      e=yc-yb;
                      f=sqrt(d*d+e*e);//勾股定理求b
                      g=xc-xa;
                      h=yc-ya;
                      i=sqrt(g*g+h*h);//勾股定理求c
                      j=c+f+i;
                      t=j/2;
                      k=t-c;
                      l=t-f;
                      m=t-i;
                      cout << fixed << setprecision(2)<<sqrt(t*k*l*m);//海伦公式求面积
                      return 0;
                  }
                  
                  • 1

                  Information

                  ID
                  520
                  Time
                  1000ms
                  Memory
                  256MiB
                  Difficulty
                  4
                  Tags
                  # Submissions
                  178
                  Accepted
                  88
                  Uploaded By