PROBLEM LINK:
Author: Shubham Sharma
Editorialist: Rishab Agrawal
Tester : Syed Ali Aatif
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
QUICK EXPLANATION:
The answer is found by comparing the number of cakes that can be made from the quantity of each ingredient, and then selecting the smallest number.
EXPLANATION:
After converting y from kilograms to grams, and z from litres to millilitres, the quantities x/a, y/b and z/c are found. The three values are truncated to obtain integers. These are compared to find the smallest value which gives the minimum number of cakes that can be made.
SOLUTION
Setter's Solution
#include<bits/stdc++.h>
using namespace std;
void numberofcakes(){
int a,b,c,x,y,z;
cin>>a>>b>>c>>x>>y>>z;
y = y*1000;
z = z*1000;
cout<<min({x/a,y/b,z/c})<<endl;
}
int main(){
int t;
cin>>t;
while(t--)
numberofcakes();
return 0;
}