PARLIAMENT - Editorial

PROBLEM LINK:

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

Author: jeevanjyot
Tester & Editorialist: iceknight1093

DIFFICULTY:

419

PREREQUISITES:

None

PROBLEM:

Out of N members present in Chefland’s parliament, X of them voted for a resolution and the others voted against it.
The resolution is passed if half or more of the members voted for it.
Is the resolution passed?

EXPLANATION:

Use an if condition to check whether the condition is true, and print Yes or No appropriately.

As for the condition itself, we want to check whether X is at least half of N.
This is true only when 2X \geq N, so check for that.

TIME COMPLEXITY

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

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    n, x = map(int, input().split())
    print('Yes' if 2*x >= n else 'No')