题解 | #三角形判断#
三角形判断
https://www.nowcoder.com/practice/689ec1e742394e09b1059556fc167b65
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { vector<int> arr; arr.resize(3, 0); while(cin >> arr[0] >> arr[1] >> arr[2]) { sort(arr.begin(), arr.end()); if(arr[0] + arr[1] > arr[2]) { if(arr[0] == arr[2]) cout << "Equilateral triangle!" << '\n'; else if(arr[0] == arr[1] || arr[1] == arr[2]) cout << "Isosceles triangle!" << '\n'; else cout << "Ordinary triangle!" << '\n'; } else { cout << "Not a triangle!" << '\n'; } } return 0; }