P5717 【深基3.习8】三角形分类 这道题为什么通不过
查看原帖
P5717 【深基3.习8】三角形分类 这道题为什么通不过
531434
若即若离楼主2021/6/26 21:42
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;


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


}

大神求解!

2021/6/26 21:42
加载中...