**Author:** Shivam Pawase

**Tester:** Rushang Gajjal

**Editorialist:** Sangram Desai

## DIFFICULTY:

CAKEWALK, SIMPLE-EASY .

## PREREQUISITES:

Math

## PROBLEM:

There are two items potatoes and tomatoes, we need to tell whether it is possible to buy equal quantity of potatoes and tomatoes from market or not.

### QUICK EXPLANATION:

So we just want to check LCM(x,y)/x and LCM(x,y)/y must be less than n and m respectively.

### EXPLANATION:

Weight = Item weight * Number of tomatoes / potatoes

let’s consider a variable such that after multiplying with x and y gives an equal weight of potatoes and tomatoes.

Also, weight must be less than the total weight of items in the market.

LCM of x and y gives that number which satisfies the conditions

for example,

```
we have x = 3 y = 5 n = 5 and m = 3
x = 3,9,12,15,..
y = 5,10,15,20,..
```

we get 15 as equal weight so LCM becomes 15, now no. of potatoes = 15/x and no. of tomatoes = 15/y . Which is less than the total number items n and m respectively.

### AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here

Tester’s solution can be found here