304 North Cardinal St.
Dorchester Center, MA 02124

# Chef and Masks CodeChef Solution

## Problem – Chef and Masks CodeChef Solution

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?

### Input Format

• The first line of input will contain a single integer T, denoting the number of test cases. Then the test cases follow.
• Each test case consists of a single line of input, containing two space-separated integers X,Y.

### Output Format

For each test case, if Chef buys the cloth masks print `CLOTH`, otherwise print `DISPOSABLE`.

You may print each character of the string in uppercase or lowercase (for example, the strings `cloth``clOTh``cLoTH`, and `CLOTH` will all be treated as identical).

• 1≤T≤5000
• 1≤X<Y≤100

### Sample 1:

``````Input: 4
10 100
9 100
88 99
1 11
Output: Cloth
Disposable
Cloth
Disposable``````

### Explanation:

Test case 1: The cost of the disposable masks will be 10⋅100=1000, while the cost of the cloth masks will be 100⋅10=1000. Since the price is equal and Chef is eco-friendly, Chef will buy the cloth masks.

Test case 2: The cost of the disposable masks will be 9⋅100=900, while the cost of the cloth masks will be 100⋅10=1000. Since the price of disposable masks is less, Chef will buy the disposable masks.

Test case 3: The cost of the disposable masks will be 88⋅100=8800, while the cost of the cloth masks will be 99⋅10=990. Since the price of the cloth masks is less, Chef will buy the cloth masks.

Test case 4: The cost of the disposable masks will be 1⋅100=100, while the cost of the cloth masks will be 11⋅10=110. Since the price of disposable masks is less, Chef will buy the disposable masks.

### Chef and Masks CodeChef Solution in Java

``````import java.util.*;
import java.io.*;
class Solution
{
final static int MOD = (int)1e9+7;
static class Swaraj
{
StringTokenizer st;

Swaraj()
{
}

String next()
{
while(st==null || !st.hasMoreElements())
{
try
{
}
catch(IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}

String nextLine()
{
String s = new String();
try
{
}
catch(IOException e)
{
e.printStackTrace();
}
return s;
}

int ni()
{
return Integer.parseInt(next());
}
long nl()
{
return Long.parseLong(next());
}
float nf()
{
return Float.parseFloat(next());
}
double nd()
{
return Double.parseDouble(next());
}
char nc()
{
return next().charAt(0);
}
}

public static void main(String args[])throws IOException
{
Swaraj br = new Swaraj();
StringBuilder ans = new StringBuilder();
//int t = 1;
int t = br.ni();
while(t-- > 0)
{
int x = br.ni(), y = br.ni();
ans.append(y*10 <= x*100? "CLOTH\n": "DISPOSABLE\n");
}
System.out.println(ans);
}

}``````

### Chef and Masks CodeChef Solution in C++ 17

``````#include <iostream>
using namespace std;

int main() {
int t,x,y;
cin>>t;
while(t--){
cin>>x>>y;
if((x*100)>=(y*10)){
cout<<"cloth"<<endl;
}
else{
cout<<"disposable"<<endl;
}
}
return 0;
}
``````

### Chef and Masks CodeChef Solution in Pyth 3

``````for _ in range(int(input())):
x,y=map(int,input().split())
if (x*100)>=(y*10):
print("Cloth")
else:
print("Disposable")``````
##### Chef and Masks CodeChef Solution Review:

In our experience, we suggest you solve this Chef and Masks CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Chef and Masks CodeChef Solution

Find on CodeChef

##### Conclusion:

I hope this Chef and Masks CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions