SHLY - Editorial

PROBLEM LINK:

[Practice] (CodeChef: Practical coding for everyone)

Author [Siddharth Jha]
(https://www.codechef.com/users/sidjha69)

DIFFICULTY:

SIMPLE

PREREQUISITES:

Maths

PROBLEM:

Thakur’s housekeeper is Ramu kaka one day they both were walking in the garden, Thakur see’s a big mango tree and asks Ramu kaka to get the maximum number of mangones among M mangoes on tree, that are divisible by K house’s in the village, how many mangoes will Ramu kaka bring.

QUICK EXPLANATION:

The number of mangoes that ramu would have brought would be M/K except when either of them would be 0

SOLUTIONS:

Setter's Solution
//created by sidjha69
#include <iostream>

using namespace std;

long long int solve (long long int x, long long y) {
    if (y == 0 || x == 0) return 0;
     return x/y;
}

int main () {
    long long int M,K;
    cin >> M >> K;
    cout << solve(M,K);
    return 0;
}