PAR2 - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: Ashu Mittal
Testers: Takuki Kurokawa, Utkarsh Gupta
Editorialist: Nishank Suresh

DIFFICULTY:

295

PREREQUISITES:

None

PROBLEM:

There are N chocolates. Can they be divided equally among two people?

EXPLANATION:

The chocolates can be divided equally if and only if there are an even number of them…

So, just check if N is even using an if condition and print Yes if it is, No if it isn’t.

TIME COMPLEXITY

\mathcal{O}(1) per test case.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    print('Yes' if int(input())%2 == 0 else 'No')