9 solutions
-
3
//我的最简洁 #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
#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
#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
#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
#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
#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
#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
#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