Knowee
Questions
Features
Study Tools

Ayan is shopping for masks. In the shop, he encounters 2 types of masks:Disposable Masks — cost X per mask and lasts for 5 daysCloth Masks — cost Y per mask and lasts for 10 daysWrite a program that takes the cost of Disposable Masks (X) and Cloth Masks (Y). The program should determine which type of mask Ayan should choose to minimize his expenses and print the decision. In case of a tie, he prefers Cloth Masks for environmental reasons.Write a program for the same using a for loop.For example: If X=10 & Y=100:Disposable masks last for 5 days, so the total cost is 10*5=50.Cloth masks last for 10 days, so the total cost is 100*10=1000.Disposable masks cost (50) < Cloth masks cost (10000). So Ayan prefers Disposable masks.Input format :The first line of input will contain a single integer t, denoting the number of test cases.In each of the next t lines, the input consists of two space-separated integers X and Y representing the cost of Disposable Masks and Cloth Masks respectively.Output format :For each test case, the output displays "Cloth" if Ayan buys the cloth masks. Otherwise, the output displays "Disposable".Refer to the sample output for formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:2 ≤ n ≤ 101 ≤ Cost of each mask ≤ 100Sample test cases :Input 1 :410 100100 1014 71 11Output 1 :DisposableClothClothDisposableInput 2 :2100 988 99Output 2 :ClothDisposableInput 3 :101 23 45 67 89 1011 12100 1415 1699 1819 20Output 3 :DisposableDisposableDisposableDisposableDisposableDisposableClothDisposableClothDisposable

Question

Ayan is shopping for masks. In the shop, he encounters 2 types of masks:Disposable Masks — cost X per mask and lasts for 5 daysCloth Masks — cost Y per mask and lasts for 10 daysWrite a program that takes the cost of Disposable Masks (X) and Cloth Masks (Y). The program should determine which type of mask Ayan should choose to minimize his expenses and print the decision. In case of a tie, he prefers Cloth Masks for environmental reasons.Write a program for the same using a for loop.For example: If X=10 & Y=100:Disposable masks last for 5 days, so the total cost is 105=50.Cloth masks last for 10 days, so the total cost is 10010=1000.Disposable masks cost (50) < Cloth masks cost (10000). So Ayan prefers Disposable masks.Input format :The first line of input will contain a single integer t, denoting the number of test cases.In each of the next t lines, the input consists of two space-separated integers X and Y representing the cost of Disposable Masks and Cloth Masks respectively.Output format :For each test case, the output displays "Cloth" if Ayan buys the cloth masks. Otherwise, the output displays "Disposable".Refer to the sample output for formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:2 ≤ n ≤ 101 ≤ Cost of each mask ≤ 100Sample test cases :Input 1 :410 100100 1014 71 11Output 1 :DisposableClothClothDisposableInput 2 :2100 988 99Output 2 :ClothDisposableInput 3 :101 23 45 67 89 1011 12100 1415 1699 1819 20Output 3 :DisposableDisposableDisposableDisposableDisposableDisposableClothDisposableClothDisposable

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The problem is asking to write a program that will determine which type of mask Ayan should choose to minimize his expenses. The program should take the cost of Disposable Masks (X) and Cloth Masks (Y) as input. If the cost of Disposable Masks is less than Cloth Masks, the program should print "Disposable". If the cost of Cloth Masks is less than Disposable Masks, the program should print "Cloth". If the costs are equal, the program should print "Cloth" because Ayan prefers Cloth Masks for environmental reasons.

Here is a Python solution using a for loop:

t = int(input())
for _ in range(t):
    X, Y = map(int, input().split())
    if X * 5 <= Y * 10:
        print("Disposable")
    else:
        print("Cloth")

This program works by first reading the number of test cases. Then for each test case, it reads the cost of Disposable Masks and Cloth Masks. It then checks if the cost of Disposable Masks for 5 days is less than or equal to the cost of Cloth Masks for 10 days. If it is, it prints "Disposable". Otherwise, it prints "Cloth".

This problem has been solved

Similar Questions

Input format :The first line of input will contain a single integer t, denoting the number of test cases.In each of the next t lines, the input consists of two space-separated integers X and Y representing the cost of Disposable Masks and Cloth Masks respectively.Output format :For each test case, the output displays "Cloth" if Ayan buys the cloth masks. Otherwise, the output displays "Disposable".

Find out how many cars the baseball team needs to wash before it starts making a profit. The team spent $75setting up the car wash, and they are charging $5 per car for a wash.A. Write an equation to represent the amount ofmoney collected in dollars, y, in terms of the numberof cars washed, x. Ignore the setup cost. 𝑦 = 𝑥B. What do you need to do to the equation in part Ato account for the setup cost?To account for the setup cost, you need to_______add _______subtract 75 from the right sideof the equation obtained in part A.C. Write an equation representing the profit madeon the car wash in dollars, y, in terms of the numberof cars washed, x, after expenses. 𝑦 = 𝑥D. What is the value of the profit when the baseballteam washes 0 cars? What point represents thisvalue? What does the y-value of this point mean interms of the problem?E. How many cars does the baseball team have towash to break even? What point represents thisvalue? What does the x-value of this point mean interms of the problem?

Single File Programming QuestionProblem StatementLilly went shopping with a budget of Rs. 10,000 to buy clothes, and accessories. The cost of clothes is twice the value of accessories, and there is an additional expense of Rs. 1000 for fuel. Develop an expense calculator by inputting the amount spent on accessories, then calculate and display Lilly's remaining amount rounded to two decimal places after her shopping.ExampleInput:2000.0Output:3000.0Explanation:budget = 10000.0;fuel = 1000.0;accessories = 2000.0clothes = 2 * accessories = 2 * 2000 = 4000.0total = clothes + accessories + fuel = 4000.0 + 2000.0 + 1000.0 = 7000.0remaining = budget - total = 10000.0 - 7000.0 = 3000.0Input format :The input consists of a float value a, representing the amount spent on accessories.Output format :The output prints the remaining budget after shopping, rounded to two decimal places in the following format: "Rs. [remaining amount]". Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:10.0 ≤ a ≤ 3000.0Sample test cases :Input 1 :10.0Output 1 :Rs. 8970.00Input 2 :2000.0Output 2 :Rs. 3000.00Input 3 :3000.0Output 3 :Rs. 0.00Input 4 :1578.89Output 4 :Rs. 4263.33

Single File Programming QuestionProblem StatementLilly went shopping with a budget of Rs. 10,000 to buy clothes, and accessories. The cost of clothes is twice the value of accessories, and there is an additional expense of Rs. 1000 for fuel. Develop an expense calculator by inputting the amount spent on accessories, then calculate and display Lilly's remaining amount rounded to two decimal places after her shopping.ExampleInput:2000.0Output:3000.0Explanation:budget = 10000.0;fuel = 1000.0;accessories = 2000.0clothes = 2 * accessories = 2 * 2000 = 4000.0total = clothes + accessories + fuel = 4000.0 + 2000.0 + 1000.0 = 7000.0remaining = budget - total = 10000.0 - 7000.0 = 3000.0Input format :The input consists of a float value a, representing the amount spent on accessories.Output format :The output prints the remaining budget after shopping, rounded to two decimal places in the following format: "Rs. [remaining amount]". Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:10.0 ≤ a ≤ 3000.0Sample test cases :Input 1 :10.0Output 1 :Rs. 8970.00Input 2 :2000.0Output 2 :Rs. 3000.00Input 3 :3000.0Output 3 :Rs. 0.00Input 4 :1578.89Output 4 :Rs. 4263.33Note :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.

A woodworking artist makes two types of carvings: type X and type Y. He spends 3 hours making each type X carving and 2 hours making each type Y carving, and he can spend up to 30 hours each week making carvings. His materials cost him $5 for each type X carving and $7 for each type Y carving, and he must keep his weekly cost for materials to $105 or less. If x is the number of type X carvings he makes in a week and y is the number of type Y carvings he makes in a week, which of the following systems of inequalities models this situation?A.3x + 2y ≥ 30, 5x + 7y ≥ 105B.3x + 2y ≥ 30, 5x + 7y ≤ 105C.3x + 2y ≤ 30, 5x + 7y ≤ 105D.3x + 2y ≤ 30, 5x + 7y ≥ 105SUBMITarrow_backPREVIOUS

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.