1. 程式人生 > >ACM周賽第四題

ACM周賽第四題

題目連結:https://vjudge.net/problem/HDU-2039

#include <iostream>
using namespace std;
int main()
{
	int i, M;
	cin >> M;
	double *p;
	p = (double*)malloc((M*3) * sizeof(double));
	for (i = 0; i <3* M; i++)
	{
		cin >> p[i];
		if (p[i]<=0&&p[i] > 1000 )
			return 0;
	}
	for (i = 0; i < 3 * M; i=i+3)
	{
		if (p[i] + p[i + 1] > p[i + 2] && p[i] + p[i + 2] > p[i + 1] && p[i + 1] + p[i + 2] > p[i])
			cout << "YES" ;
		else cout << "NO";
		cout << '\n';
	}
}