7 条题解
- 1
信息
- ID
- 41
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 919
- 已通过
- 347
- 上传者
a,b,c=map(int,input().split())
p=(a+b+c)/2
if a+b<=c or a+c<=b or b+c<=a:
print("Data Error!")
else:
print("%.2f" %((p*(p-a)*(p-b)*(p-c))**(1/2)))
#include <bits/stdc++.h> using namespace std; double s; int main() { int a,b,c,p; cin>>a>>b>>c; p=(a+b+c)/2; s=sqrt(p*(p-a)(p-b)(p-c)); if(a+b<=c or a+c<=b or b+c<=a){ cout<<"Data Error"; }else{ printf("%.2f",s); }
return 0;
}
彩笔小季
#include <bits/stdc++.h>
using namespace std; double a,b,c,S,p;
int main() { cin>>a>>b>>c; if(a>0 and b>0 and c>0 and a+b>c and a+c>b and b+c>a){ p=0.5*(a+b+c); S=sqrt(p*(p-a)(p-b)(p-c)); printf("%.2f",S); }else{ cout<<"Data Error!"<<endl; }
return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a,b,c,s,p;
int main() {
cin>>a>>b>>c;
if(a+b<=c or a+c<=b or b+c<=a)
{
cout<<"Data Error!";
}
else{
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
printf("%.2f",s);
}
return 0;
}
python
a, b, c = map(float, input().split()) if a + b > c and a + c > b and b + c > a: p = (a + b + c) / 2 s = (p * (p - a) * (p - b) * (p - c)) ** 0.5 print("{:.2f}".format(s)) else: print("Data Error!")