PAINTCHRIS - Editorial

PROBLEM LINK:

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

Author: notsoloud
Tester: yash_daga
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

Painting 1 square meter of wall costs 2 rupees.
With Z rupees, how many X\times Y walls can you fully paint?

EXPLANATION:

An X\times Y wall needs 2\cdot XY rupees to paint it entirely.
So, with Z rupees, we can paint

\left\lfloor \frac{Z}{2\cdot XY} \right\rfloor

walls fully, where \left\lfloor \ \ \right\rfloor denotes the floor function.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
    x, y, z = map(int, input().split())
    per_wall = 2*x*y
    print(z//per_wall)
1 Like