Which Mixture: MIXTURE
Which Mixture CodeChef solution in C, C++, JAVA, and PYTHON
Public Submission link: Click here (anyone can submit here )
CU Submission link: Click here (need login by CU account)
Read problem statements in Bengali, Mandarin Chinese, Russian, and Vietnamese as well.
Chef has AA units of solid and BB units of liquid. He combines them to create a mixture. What kind of mixture does Chef produce: a solution, a solid, or a liquid?
A mixture is called :
1) A solution if A>0A>0 and B>0B>0,
2) A solid if B=0B=0, or
3) A liquid if A=0A=0.
Input Format
- The first line contains TT denoting the number of test cases. Then the test cases follow.
- Each test case contains two space-separated integers AA and BB on a single line.
Output Format
For each test case, output on a single line the type of mixture Chef produces, whether it is a Solution
, Solid
, or Liquid
. The output is case sensitive.
Constraints
- 1≤T≤201≤T≤20
- 0≤A,B≤1000≤A,B≤100
- A+B>0A+B>0
Subtasks
- Subtask 1 (100 points): Original constraints
Sample Input 1
3
10 5
0 3
3 0
Sample Output 1
Solution
Liquid
Solid
Explanation
Test case 11: Chef adds both solid and liquid to the mixture, hence the mixture is a solution.
Test case 22: Chef does not add solid to the mixture, hence the mixture is liquid.
Test case 33: Chef does not add liquid to the mixture, hence the mixture is solid.
Which Mixture codechef solution in C
int main()
{
int c,a,b;
scanf("%d",&c);
while(c--)
{
scanf("%d%d",&a,&b);
if(a>0&&b>0)
printf("Solution\n");
else if(b==0&&a!=0)
printf("Solid\n");
else
printf("Liquid\n");
}
return 0;
}
Which Mixture codechef solution in C++ 17
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int a,b;
cin>>a>>b;
if(a>0 && b>0)
cout <<"Solution\n";
else if(a==0)
cout <<"Liquid\n";
else
cout <<"Solid\n";
}
return 0;
}
Which Mixture codechef solution in Python 3
for i in range(int(input())):
a,b=map(int,input().split())
if a==0:
print("Liquid")
if b==0:
print("Solid")
if a>0 and b>0:
print("Solution")
Which Mixture CodeChef solution in Java
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
try{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=1;i<=t;i++){
int A=sc.nextInt();
int B=sc.nextInt();
if((A>0)&&(B>0))
System.out.println("Solution");
else if(B==0)
System.out.println("Solid");
else if(A==0)
System.out.println("Liquid");
}
}
catch(Exception e){
return;
}
}
}
Which Mixture CodeChef solution