# PROBLEM LINK:

Contest Division 1

Contest Division 2

Contest Division 3

Contest Division 4

Setter: Yuvraj Garg

Tester: Jakub Safin, Satyam

Editorialist: Pratiyush Mishra

# DIFFICULTY:

482

# PREREQUISITES:

None

# PROBLEM:

You are given that a mango weighs X kilograms and a truck weighs Y kilograms.

You want to cross a bridge that can withstand a weight of Z kilograms.

Find the **maximum** number of mangoes you can load in the truck so that you can cross the bridge safely.

# EXPLANATION:

Given the maximum weight that the bridge can withstand is Z kilograms and the weight of truck is Y, so the maximum weight of mangoes that the truck can carry would be (Z-Y) kilograms. Now we need to check how many mangoes can be loaded in the truck when its limit is (Z-Y), which would be as follows:

# TIME COMPLEXITY:

O(1) for each test case.

# SOLUTION:

Editorialist’s Solution

Setter’s Solution

Tester1’s Solution

Tester2’s Solution