[Solution] Chef and Masks solution codechef

Chef and Masks solution codechef – Chef is shopping for masks. In the shop, he encounters 22 types of masks:

  • Disposable Masks — cost XX but last only 11 day.
  • Cloth Masks — cost YY but last 1010 days.

[Solution] Chef and Masks solution codechef

Chef wants to buy masks to last him 100100 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 TT, 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,YX,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 clothclOThcLoTH, and CLOTH will all be treated as identical).

[Solution] Chef and Masks solution codechef

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

Sample Input 1 

4
10 100
9 100
88 99
1 11

Sample Output 1 

Cloth
Disposable
Cloth
Disposable

Chef and Masks solution Explanation

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

Test case 22: The cost of the disposable masks will be 9100=9009⋅100=900, while the cost of the cloth masks will be 10010=1000100⋅10=1000. Since the price of disposable masks is less, Chef will buy the disposable masks.

Test case 33: The cost of the disposable masks will be 88100=880088⋅100=8800, while the cost of the cloth masks will be 9910=99099⋅10=990. Since the price of the cloth masks is less, Chef will buy the cloth masks.

Test case 44: The cost of the disposable masks will be 1100=1001⋅100=100, while the cost of the cloth masks will be 1110=11011⋅10=110. Since the price of disposable masks is less, Chef will buy the disposable masks.

For Solution

Click here

Leave a Comment