Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef is shopping for masks. In the shop, he encounters 2 types of masks:
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?
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).
Input: 4
10 100
9 100
88 99
1 11
Output: Cloth
Disposable
Cloth
Disposable
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.
import java.util.*;
import java.io.*;
class Solution
{
final static int MOD = (int)1e9+7;
static class Swaraj
{
BufferedReader br;
StringTokenizer st;
Swaraj()
{
br=new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while(st==null || !st.hasMoreElements())
{
try
{
st=new StringTokenizer(br.readLine());
}
catch(IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
String nextLine()
{
String s = new String();
try
{
s=br.readLine();
}
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);
}
}
#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;
}
for _ in range(int(input())):
x,y=map(int,input().split())
if (x*100)>=(y*10):
print("Cloth")
else:
print("Disposable")
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
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 >>