PROBLEM LINK:
Author: Mradul Bhatnagar
Tester: Harris Leung
DIFFICULTY:
432
PREREQUISITES:
None
PROBLEM:
Chef is shopping for masks. In the shop, he encounters 2 types of masks:
- Disposable Masks — cost X but last only 1 day.
- Cloth Masks — cost Y but last 10 days.
Chef wants to buy masks to last him 100 days. He will buy the masks which cost him the least. In case there is a tie in terms of cost, Chef will be eco-friendly and choose the cloth masks. Which type of mask will Chef choose?
EXPLANATION:
For 100 days, Chef will require \frac{100}{1} = 100 disposable masks or \frac{100}{10} = 10 cloth masks.
Therefore if 100 \cdot X \lt 10 \cdot Y, Chef will buy Disposable
masks, otherwise he will buy Cloth
masks.
SOLUTIONS:
Setter's Solution
#include <bits/stdc++.h>
using namespace std;
int main()
{
int test_cases;
cin>>test_cases;
for(int tc = 1 ; tc <= test_cases ; tc++)
{
int disposable_price , cloth_price;
cin>>disposable_price>>cloth_price;
if((100 * disposable_price) < (10 * cloth_price))
cout<<"Disposable"<<endl;
else
cout<<"Cloth"<<endl;
}
return 0;
}