codeforce 512 (div.2) A. In Search of an Easy Problem

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
n people about their opinions. Each person answered whether this problem is easy or hard.

If at least one of these 
n
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
n (
1

n

100
1≤n≤100) — the number of people who were asked to give their opinions.

The second line contains 
n
n integers, each integer is either 
0
0 or 
1
1. If 
i
i-th integer is 
0
0, then 
i
i-th person thinks that the problem is easy; if it is 
1
1, then 
i
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.

Examples
inputCopy
3
0 0 1
outputCopy
HARD
inputCopy
1
0
outputCopy
EASY
Note
In the first example the third person says it's a hard problem, so it should be replaced.

In the second example the problem easy for the only person, so it doesn't have to be replaced.

给一个n,给一个长度为n的序列。问当中是否有1.

#pragma GCC optimize(2)
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;
const int maxn = 500;
const int inf = 0x3f3f3f3f;
typedef long long ll;
int a[maxn];
int main()
{
	//freopen("C://input.txt", "r", stdin);
	int n;
	int flag = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		if (a == 1)
		{
			flag = 1;
		}
	}
	if (flag == 1)
	{
		printf("HARD\n");
	}
	else
	{
		printf("EASY\n");
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/Evildoer_llc/article/details/82825882