Source Code
#include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    long long int t, a, b, x, dif, mx, mn;
    cin >> t;
    while (t--) {
        cin >> a >> b >> x;
        mx = max(a, b);
        mn = min(a, b);
        dif = abs(a - b);
        //cout << dif;
        if (a == x || b == x)
            cout << "YES\n";
        else if (x < a && x < b) {
            cout << "NO\n";
        }
        else if (a == b)
            cout << "NO\n";

        else if (x%  dif == 0 && x >= mx + dif) {
            cout << "YES\n";
        }
        else {
            cout << "NO\n";

        }
    }

    return 0;
}
Copy
Good Guy Jim lufa3
GNU G++17
3 ms
304 KB
Wrong Answer