Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
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 A, B, C, representing the information for each shoe, find out whether you can go out now, wearing one left shoe and one right shoe.
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.
Input:
3
0 0 0
0 1 1
1 0 1
Output:
0
1
1
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.
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")
#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;
}
/* 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");
}
}
}
}
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
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 >>