Input
輸入數(shù)據(jù)第一行包含一個數(shù)M,接下有M行,每行一個實例些椒,包含三個正數(shù)A,B,C灭必。其中A,B,C <1000;
Output
對于每個測試實例狞谱,如果三條邊長A,B,C能組成三角形的話,輸出YES禁漓,否則NO跟衅。
#include<iostream>
using namespace std;
void three(double a[3]) {
if (a[0] + a[1] > a[2] && a[1] + a[2] > a[0] && a[2] + a[0] > a[1]) {
cout << "YES";
}
else cout << "NO";
}
int main() {
int a;
cin >> a;
double **p = new double*[a];
for (int count = 0; count < a; count++) {
p[count] = new double[3];
}//動態(tài)二維數(shù)組,寬度確定
for (int i = 0; i < a; i++) {
for (int j = 0; j < 3; j++) {
cin >> p[i][j];
}
}//輸入動態(tài)二維數(shù)組
for (int i = 0; i < a; i++) {
three(p[i]);
cout << endl;
}
return 0;
}