Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef has 3 numbers A,B and C.
Chef wonders if it is possible to choose exactly two numbers out of the three numbers such that their sum is odd.
For each test case, output YES
if you can choose exactly two numbers with odd sum, NO
otherwise.
The output is case-insensitive. Thus, the strings YES
, yes
, yeS
, and Yes
are all considered the same.
Input:
4
1 2 3
8 4 6
3 3 9
7 8 6
Output:
YES
NO
NO
YES
Test case 1: Chef can choose 2 and 3 since 2+3=5 and 5 is odd.
Test case 2: It can be shown that Chef cannot choose two numbers among 8, 4 and 6 with odd sum.
# cook your dish here
t=int(input())
for i in range(t):
a,b,c=map(int,input().split())
if a%2==0 and b%2==0 and c%2==0:
print("NO")
elif a%2!=0 and b%2!=0 and c%2!=0:
print("NO")
else:
print("YES")
#include<bits/stdc++.h>
#define FASTIO_ ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mod 1000000007
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define itr(i,n) for(ll i=0; i<n; i++)
#define itr_ab(i,a,b) for(ll i=a; i<=b; i++)
#define itrV(i,n) for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define precise cout.precision(15);
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
#define en '\n'
using namespace std;
//use when sorting needed
bool cmp(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
if(a.se>b.se)
return 1;
else
return 0;
}
int main()
{
FASTIO_
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ll tc,n,m,x,y,i,j,k;
string s,t;
cin>>tc;
while(tc--)
{
ll x,y,z;
cin>>x>>y>>z;
ll d=x+y,ok=0;
if(d%2) ok=1;
d=z+y;
if(d%2) ok=1;
d=x+z;
if(d%2) ok=1;
if(ok) yes;
else no;
}
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 q=sc.nextInt();
while(q!=0)
{
int a=sc.nextInt();
int b=sc.nextInt();
int v=sc.nextInt();
if(((a+b)%2)!=0 || ((b+v)%2)!=0 || ((a+v)%2)!=0)
System.out.println("yes");
else
System.out.println("no");
q--;
}
}
}
In our experience, we suggest you solve this Odd Sum Pair 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 Odd Sum Pair CodeChef Solution
I hope this Odd Sum Pair 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 >>