PROBLEM LINK:
Practice
[Contest : Spark coding contest ]
Author: [Siddharth Jha]
(https://www.codechef.com/users/sidjha69)
DIFFICULTY:
SIMPLE
PREREQUISITES:
Observation, Maths
PROBLEM:
Ramesh and Suresh are best friends, Ramesh’s mother gives X ₹ to him and asks him to get Y five stars. Find the number of five stars that Ramesh can buy for Suresh from the money which is left after he buys Y five stars. Price of each 5 star is 5₹
QUICK EXPLANATION:
Just calculate the remaining money left and divide it by 5
SOLUTION:
Setter's Solution
//created by sidjha69
#include <iostream>
using namespace std;
int solve () {
int X,Y;
cin >> X >> Y;
int moneyLeft = X - 5*Y;
return moneyLeft/5;
}
int main () {
cout << solve();
return 0;
}