Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
The Chef has reached the finals of the Annual Inter-school Declamation contest.
For the finals, students were asked to prepare 10 topics. However, Chef was only able to prepare three topics, numbered A, B and C — he is totally blank about the other topics. This means Chef can only win the contest if he gets the topics A, B or C to speak about.
On the contest day, Chef gets topic X. Determine whether Chef has any chances of winning the competition.
Print “Yes” if it is possible for Chef to win the contest, else print “No”.
You may print each character of the string in either uppercase or lowercase (for example, the strings yEs
, yes
, Yes
, and YES
will all be treated as identical).
yEs
, yes
, Yes
, and YES
will all be treated as identical).Subtask #1 (100 points): Original constraints
Input: 2 3 7 3
Output: Yes
Chef had prepared the topics: 2,3,7. Chef gets to speak on the topic: 3. Since Chef had already prepared this, there is a chance that he can win the contest.
Input: 4 6 8 5
Output: No
Chef had prepared the topics: 4,6,8. Chef gets to speak on the topic: 5. Since Chef didn’t prepare this topic, there is no chance that he can win the contest.
a,b,c,x=map(int,input().split())
if x in [a,b,c]:
print("yes")
else:
print("no")
#include <iostream>
using namespace std;
int main() {
// your code goes here
int a, b, c, x;
cin>>a>>b>>c>>x;
if (x==a || x==b || x==c)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
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 in = new Scanner(System.in);
int a[] = new int[3];
for(int i=0;i<3;i++){
a[i]=in.nextInt();
}
int X = in.nextInt();
boolean flag=false;
for(int i=0;i<3;i++){
if(X==a[i]){
flag=true;
break;
}
}
System.out.println(!flag?"No":"Yes");
}
}
In our experience, we suggest you solve this The Three Topics 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 The Three Topics CodeChef Solution
I hope this The Three Topics 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 >>