Source Code
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

void solve(){
    int a,b,x;
    cin>>a>>b>>x;
    if(b>a) swap(a,b);

    if(a==x||b==x){
        cout<<"YES";
        return;
    }

    if(a==b||a>x||!b){
        cout<<"NO";
        return;
    }

    if((x-b)%a==0) cout<<"YES";
    else cout<<"NO";
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin>>t;

    while(t--){
        solve();
        cout<<'\n';
    }
}
Copy
Good Guy Jim YazanIstatiyeh
GNU G++17
7 ms
980 KB
Wrong Answer