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

void solve(){
    ll 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){
        cout<<"NO";
        return;
    }
    
    while(a<x){
        a+=a-b;
    }
    
    if(a==x) 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
30 ms
1.3 MB
Accepted