Algorithm


 problem Link :  https://www.codechef.com/problems/THREETOPICS 

Problem

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  and  — he is totally blank about the other topics. This means Chef can only win the contest if he gets the topics  or  to speak about.

On the contest day, Chef gets topic . 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 yEsyesYes, and YES will all be treated as identical).

Input Format

  • The first and only line of input will contain a single line containing four space-separated integers , and  — the three topics Chef has prepared and the topic that was given to him on contest day.

Output Format

  • For each testcase, output in a single line "Yes" or "No".
  • You may print each character of the string in either uppercase or lowercase (for example, the strings yEsyesYes, and YES will all be treated as identical).

Constraints

  • 1≤�,�,�,�≤10
  • �,�,� are distinct.

Subtasks

Subtask #1 (100 points): Original constraints

Sample 1:

Input
 
Output
 
2 3 7 3
Yes

Explanation:

 

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.

 

 

Code Examples

#1 Code Example with C Programming

Code - C Programming

 #include<stdio.h> < code>
int main()
{
    int a,b,c,x;
    scanf("%d %d %d %d",&a,&b,&c,&x);
    if (a==x || b==x || c==x) printf("YES\n");
    else printf("NO\n");
} 
Copy The Code & Try With Live Editor

Input

x
+
cmd
2 3 7 3

Output

x
+
cmd
Yes
Advertisements

Demonstration


CodeChef solution THREETOPICS  - The Three Topics Codechef solution in C,C++

Previous
CodeChef solution TRUESCORE - Is the Score Consistent Codechef solution in C,C++
Next
CodeChef solution TODOLIST - Problems in your to-do list Codechef solution in C,C++