Source Code
	#include <iostream>
	using namespace std;
	int main()
	{
		int n;
		cin >> n;
		while (n > 0)
		{
			int a, b, x;
			cin >> a >> b >> x;
			if (b > a)
				swap(a, b);
			if (x < a && x != b)
				cout << "NO";
			else if (x == b || x == a)
				cout << "YES";
			else
			{
				int d = a - b;
				while (a < x)
				{
					a += (a - b);
					d += d;
				}
				if (a == x)
					cout << "YES";
				else
					cout << "NO";
			}
			cout << endl;
			n--;
		}
	}
Copy
Good Guy Jim Heromnxpw0
GNU G++17
2072 ms
828 KB
Time Limit Exceeded