18 条题解

  • 0
    @ 2024-3-3 13:36:39

    #include #include using namespace std;

    int main() { int a, b, c; cin >> a >> b >> c; int arr[3] = {a, b, c}; sort(arr, arr + 3); if (arr[0] + arr[1] <= arr[2]) { cout << "Not triangle" << endl; } else { if (arr[0] == arr[1] && arr[1] == arr[2]) { cout << "Equilateral triangle" << endl; } else if (arr[0] == arr[1] || arr[1] == arr[2]) { cout << "Isosceles triangle" << endl; } if (arr[2] * arr[2] == arr[0] * arr[0] + arr[1] * arr[1]) { cout << "Right triangle" << endl; } else if (arr[2] * arr[2] > arr[0] * arr[0] + arr[1] * arr[1]) { cout << "Obtuse triangle" << endl; } else { cout << "Acute triangle" << endl; } } return 0; }

    信息

    ID
    626
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    (无)
    递交数
    262
    已通过
    119
    上传者