1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 08:26:20 +00:00
202401-programming-assignments/【额外练习】选择结构/7-36 选择-三角形和圆.c

27 lines
441 B
C
Raw Permalink Normal View History

2024-10-31 08:45:40 +00:00
#include <math.h>
#include <stdio.h>
int main() {
double a, b, c, r;
scanf("%lf%lf%lf%lf", &a, &b, &c, &r);
double s = (a + b + c) / 2.0;
if (s <= a || s <= b || s <= c) {
printf("No\n");
return 0;
}
double area = sqrt(s * (s - a) * (s - b) * (s - c));
double inRadius = area / s;
if (r <= inRadius) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}