INVESTMENT - Editorial

PROBLEM LINK:

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

Author: utkarsh_25dec
Testers: IceKnight1093, tejas10p
Editorialist: IceKnight1093

DIFFICULTY:

357

PREREQUISITES:

None

PROBLEM:

Chef invested money at a rate of X percent per annum, while inflation is Y percent.
An investment is good if its interest rate is at least twice the inflation rate.
Is Chef’s investment good?

EXPLANATION:

According to the statement, the investment is good if and only if X (the interest rate) is at least twice of Y (the inflation rate), i.e, X \geq 2Y.

So, check whether X \geq 2Y using an if condition, and print the answer appropriately.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Code (Python)
for _ in range(int(input())):
    x, y = map(int, input().split())
    print('Yes' if 2*y <= x else 'No')