LITRATE - Editorial

PROBLEM LINK:

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

Author: notsoloud
Tester: raysh_07
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

Given the population P and number of literate people L in Chefland, check if the literacy rate is at least 75\%.

EXPLANATION:

As the statement mentions, the literacy rate is \frac{L}{P} \cdot 100 \%.
More specifically, the literacy rate is \geq 75\% if and only if \frac{L}{P} \geq 0.75, i.e, the proportion of people that are literate is at least 0.75.

So, simply use an if condition to check whether \frac{L}{P} \geq 0.75 or not.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    p, l = map(int, input().split())
    print('Yes' if l/p >= 0.75 else 'No')

Here’s the code

t = int(input())
for t in range(0,t):
x,y = map(int,input().split())
n = (y/x)*100
if(n>=75):
print(“yes”)
else:
print(“no”)