4 条题解
-
2
p822和p879的结合,想进阶可做p825
#include<iostream> #include<iomanip> #include<stdio.h> #include<math.h> #include<string> #include<cstring> using namespace std; int main(){ double a,b,c,p,maxx,sum; cin>>a>>b>>c; maxx=max(a,max(b,c)); sum=a+b+c; if(maxx<sum-maxx){ p=(a+b+c)/2; printf("%.2lf",sqrt(p*(p-a)*(p-b)*(p-c))); }else{ cout<<"No Solution."; } }
-
1
#include <iostream> #include <algorithm>//sort()头文件 #include <cmath>//sqrt()头文件 using namespace std; float a[4], p;//输出要求浮点数,故可直接用float定义,为方便排序,可直接用数组存储a, b, c int main() { cin >> a[1] >> a[2] >> a[3]; sort(a + 1, a + 4); if(a[1] + a[2] <= a[3]) { puts("No Solution."); return 0; } p = (a[1] + a[2] + a[3]) / 2; printf("%.2f\n", sqrt(p * (p - a[1]) * (p - a[2]) * (p - a[3]))); return 0; }
-
0
#include <stdio.h> #include <iostream> #include <math.h> #include<iomanip> using namespace std; int main() { double a,b,c,p,x; cin >> a >> b >> c; p=(a+b+c)/2; x=(p-a)*(p-b)*(p-c)*p; double s=sqrt(x); if(a+b > c && a + c > b && c + b > a) { cout<<fixed<<setprecision(2)<<s<<endl; } else { cout<<"No Solution."; } }
- 1
信息
- ID
- 878
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- (无)
- 递交数
- 834
- 已通过
- 283
- 上传者