#include <stdio.h>
#include <math.h>
typedef struct {
double a;
double b;
double c;
} Triangle;
double calculateArea(Triangle t) {
double s = (t.a + t.b + t.c) / 2.0;
return sqrt(s
* (s
- t.
a) * (s
- t.
b) * (s
- t.
c)); }
int main(void) {
Triangle t;
if ((t.a + t.b > t.c) && (t.a + t.c > t.b) && (t.b + t.c > t.a)) {
double area = calculateArea(t);
printf("三角形の面積: %.6lf\n", area
); } else {
printf("入力された辺は三角形を構成できません。\n"); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+Cgp0eXBlZGVmIHN0cnVjdCB7CiAgICBkb3VibGUgYTsKICAgIGRvdWJsZSBiOwogICAgZG91YmxlIGM7Cn0gVHJpYW5nbGU7Cgpkb3VibGUgY2FsY3VsYXRlQXJlYShUcmlhbmdsZSB0KSB7CiAgICBkb3VibGUgcyA9ICh0LmEgKyB0LmIgKyB0LmMpIC8gMi4wOyAgCiAgICByZXR1cm4gc3FydChzICogKHMgLSB0LmEpICogKHMgLSB0LmIpICogKHMgLSB0LmMpKTsgIAp9CgppbnQgbWFpbih2b2lkKSB7CiAgICBUcmlhbmdsZSB0OyAgCiAgICBwcmludGYoIuS4ieinkuW9ouOBrui+uuOCkuWFpeWKm+OBl+OBpuOBj+OBoOOBleOBhDpcbiIpOwogICAgcHJpbnRmKCJhOiAiKTsKICAgIHNjYW5mKCIlbGYiLCAmdC5hKTsKICAgIHByaW50ZigiYjogIik7CiAgICBzY2FuZigiJWxmIiwgJnQuYik7CiAgICBwcmludGYoImM6ICIpOwogICAgc2NhbmYoIiVsZiIsICZ0LmMpOwoKICAgIGlmICgodC5hICsgdC5iID4gdC5jKSAmJiAodC5hICsgdC5jID4gdC5iKSAmJiAodC5iICsgdC5jID4gdC5hKSkgewogICAgICAgIAogICAgICAgIGRvdWJsZSBhcmVhID0gY2FsY3VsYXRlQXJlYSh0KTsKCiAgICAgICAgcHJpbnRmKCJcbmE6ICUuMmxmXG4iLCB0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