Solution of 'Equal Coins' (Codechef November Challenge 2021 Div 3)

Hola guys!!

Here's my solution to the problem- 'Equal Coins' from Codechef November Challenge 2021 Div3. If you have any suggestions do comment. Happy Coding!!

This question mainly tests your maths  skills.

Question Link: https://www.codechef.com/NOV21C/problems/EQUALCOIN


#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
using namespace std;

int32_t main()
{
    int t;
    cin>>t;
    while(t--){
        int x,y;
        cin>>x>>y;
        int sum=x+y*2;
        if(sum!=0){
            if(x!=0&&sum%2==0) cout<<"YES"<<'\n'; // like 4 3
            else if(x==0&&y%2==0) cout<<"YES"<<'\n'; // like 0 4
            else cout<<"NO"<<'\n'; //like 0 3
        }
        else cout<<"NO"<<'\n'; // like 1 4
    }
    return 0;
}

Comments

Popular posts from this blog

Solution of 'Tom Riddle's Diary' (Codeforces)

Solution to the problem 'Red Light, Green Light' from Codechef

Solution to the problem 'The Squid Game' form Codechef