解析
上午模拟被博弈论虐,下午被黄色的博弈论虐
qwq
首先的一个结论是:
如果有一堆超过总体的一半,那么先手只需要守住这堆就稳赢了
如果没有这样的一堆,可以证明,最后一定可以全部拿完
假设最后有一堆k没拿完,那么说明在之前的拿取中,肯定有一个人通过一次拿取导致了
s
k
−
o
t
h
e
r
>
1
s_k-other>1
sk−other>1。
假设A在拿完一个
o
t
h
e
r
other
other的东西后,使
s
k
−
o
t
h
e
r
=
1
s_k-other=1
sk−other=1
那么B也不傻,他肯定会拿一个k堆的东西使自己不输
得证
(尽管证的稀碎)
这样分一下奇偶讨论即可
代码
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
const int N=3e5+100;
ll read() {
ll x=0,f=1;char c=getchar();
while(!isdigit(c)) {if(c=='-')f=-1;c=getchar();}
while(isdigit(c)) {x=x*10+(c^48);c=getchar();}
return x*f;
}
int n,m,q;
int main(){
int T=read();
while(T--){
int res(0),mx(0);
n=read();
for(int i=1;i<=n;i++){
int x=read();res+=x;mx=max(x,mx);
}
if((res&1)||2*mx>res) printf("T\n");
else printf("HL\n");
}
return 0;
}