Friday, 26 November 2021

In Search Of An Easy Problem !!!

 PROBLEM 11: In Search of an Easy Problem


Problem Reference : Codeforces 

When preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked n people about their opinions. Each person answered whether this problem is easy or hard.

If at least one of these n people has answered that the problem is hard, the coordinator decides to change the problem. For the given responses, check if the problem is easy enough.


Input:

The first line contains a single integer n (1n100) — the number of people who were asked to give their opinions.

The second line contains n integers, each integer is either 0 or 1. If i-th integer is 0, then i-th person thinks that the problem is easy; if it is 1, then i-th person thinks that the problem is hard.


Output:

Print one word: "EASY" if the problem is easy according to all responses, or "HARD" if there is at least one person who thinks the problem is hard.

You may print every letter in any register: "EASY", "easy", "EaSY" and "eAsY" all will be processed correctly.


Solution:


  1. n = int(input())
  2. c = [int(x) for x in input().split()]
  3.  
  4. for i in c:
  5. if i == 0:
  6. pass
  7. else:
  8. print("HARD")
  9. break
  10. else:
  11. print("EASY")



The above solution is in python language.


Examples
input
3
0 0 1
output
HARD
input
1
0
output
EASY

No comments:

Post a Comment

Rearrange an array with O(1) extra space

  PROBLEM 61:  Rearrange an array with O(1) extra space (For best view experience, view in windows version) Problem Reference : GeeksForGeek...