Result: Accepted
Time: 7ms
Memory: 1716kB
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<list>
#include<math.h>
#include<vector>
#include<stack>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<stdio.h>
#include<functional>
#include<time.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e5 + 10;
const ll mode = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846264338327950;
template <class T> inline T min(T a, T b, T c) { return min(min(a, b), c); }
template <class T> inline T max(T a, T b, T c) { return max(max(a, b), c); }
template <class T> inline T min(T a, T b, T c, T d) { return min(min(a, b), min(c, d)); }
template <class T> inline T max(T a, T b, T c, T d) { return max(max(a, b), max(c, d)); }
int a[1111];
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=0;i<1111;i++)
a[i]=-1;
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
if(n==1)
{
printf("H\n");
continue;
}
else if(a[0]==1||a[0]==0)
{
int flag=0;int i=0;
while(a[i]==1||a[i]==0)
{
if(a[i]==0)
flag--;
i++;
flag++;
//printf("%d %d\n",flag,i);
}
if(flag%2==1&&i==n)
printf("H\n");
else if(flag%2==0&&i==n)
printf("L\n");
else if(flag%2==1)
printf("L\n");
else
printf("H\n");
}
else
printf("H\n");
}
return 0;
}