SPIRUN Editorial

Problem Code: SPIRUN(CodeChef: Practical coding for everyone)
Setter : Shivam Gupta
Editorialist : Shivam Gupta

DIFFICULTY: Easy

Problem

Spider-Man is running on a straight road from block L to R. Those blocks are numbered sequentially as L, L+1, L+2, …, R−1, R. As he loves even numbers, so he will become happy if the count of even-numbered blocks are more than that of odd-numbered blocks on his traveling path. Considering he can run only in forward direction & he has to cover the whole path, is it possible for him to become happy?

Quick Explaination

Spiderman Will be happy only if he starts with even block and ends with even block.Therefore,If both L and R are even then return Yes else return No.

Solution

#include <iostream>
using namespace std;

int main() {
	// your code goes here
    int t;
    cin>>t;
    while(t--){
        int l,r;
        cin>>l>>r;
        if(l%2==0 && r%2==0){
            cout<<"Yes"<<endl;
        }
        else
            cout<<"No"<<endl;
    }
}