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||!b){
        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
22 ms
1.1 MB
Wrong Answer