Shoe Fit CodeChef Solution

Problem – Shoe Fit CodeChef Solution

You have three shoes of the same size lying around. Each shoe is either a left shoe (represented using 0) or a right shoe (represented using 1). Given ABC, representing the information for each shoe, find out whether you can go out now, wearing one left shoe and one right shoe.

Input Format

  • The first line contains an integer T, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, three integers ABC.

Output Format

For each test case, output in a single line the answer: 1 if it’s possible to go out with a pair of shoes and 0 if not.

Constraints

  • 1≤T≤8
  • 0≤A,B,C≤1

Sample 1:

Input:
3
0 0 0
0 1 1
1 0 1
Output:
0
1
1

Explanation:

Test Case 1: Since there’s no right shoe, it’s not possible to go out with a pair of shoes.

Test Case 2: It’s possible to go out with a pair of shoes wearing the first and last shoes.

Test Case 3: It’s possible to go out with a pair of shoes wearing the first and second shoes.

Shoe Fit CodeChef Solution in Pyth 3

t=int(input())
for i in range(t):
    h=list(map(int,input().split()))
    a=0
    b=1
    if (a in h and b in h):
        print("1")
    else:
        print("0")
    

Shoe Fit CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	// your code goes 
	int t;
	cin>>t;
	int n=0;
	while(n<t){
	    int a,b,c,sum;
	    cin>>a;
	    cin>>b;
	    cin>>c;
	    sum=a+b+c;
	    if(sum==1||sum==2){
	        cout<<"1"<<endl;
	    }
	    else{
	        cout<<"0"<<endl;
	    }
	    n++;
	}
	return 0;
}

Shoe Fit 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
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		for(int i=0;i<t;i++)
		{
		    int a=sc.nextInt();
		    int b=sc.nextInt();
		    int c=sc.nextInt();
		    if(a==b && b==c)
		    {
		        System.out.println("0");
		    }
		    else{
		        System.out.println("1");
		    }
		}
	}
}
Shoe Fit CodeChef Solution Review:

In our experience, we suggest you solve this Shoe Fit 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 Shoe Fit CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Shoe Fit 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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *