My issue
My code
import java.util.Scanner;
class Codechef
{
public static void Main (String[] args)
{
Scanner read = new Scanner(System.in);
int t = read.nextInt();
for(int i=0; i<t; i++)
//Update your code below this line to solve this problem
{
int costOfDisposableMask =read.nextInt(); // Replace with the actual cost of disposable masks (X)
int costOfClothMask = 10; // Replace with the actual cost of cloth masks (Y)
int days = 100;
int disposableMaskDuration = 1;
int clothMaskDuration = 10;
int totalDisposableMaskCost = costOfDisposableMask * (days / disposableMaskDuration);
int totalClothMaskCost = costOfClothMask * (days / clothMaskDuration);
if (costOfDisposableMask < costOfClothMask || totalDisposableMaskCost == totalClothMaskCost) {
System.out.println("Disposable Masks"); // Choose disposable masks if they are cheaper or there is a tie in cost
} else {
System.out.println("Cloth Masks"); // Choose cloth masks if they are cheaper
}
}
}
}
Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone