D. Stoned Game SOLUTIONS

Stoned Game SOLUTION

T is playing a game with his companion, HL. There are n heaps of stones, the I-th heap at first has ai stones. T and HL will take substituting turns, with T going first. In each turn, a player picks a non-void heap and afterward eliminates a solitary stone from it. Notwithstanding, one can’t pick a heap that has been picked in the past turn (the heap that was picked by the other player, or on the off chance that the current turn is the primary turn, at that point the player can pick any non-void heap). The player who can’t pick a heap in his turn loses, and the game closures. 

Expecting the two players play ideally, given the beginning setup of t games, decide the champ of each game. 



The main line of the info contains a solitary number t (1≤t≤100) — the quantity of games. The portrayal of the games follows. Every portrayal contains two lines: 

The principal line contains a solitary whole number n (1≤n≤100) — the quantity of heaps. 

The subsequent line contains n whole numbers a1,a2,… ,a (1≤ai≤100). 



For each game, print on a solitary line the name of the victor, “T” or “HL” (without cites) 









In the principal game, T eliminates a solitary stone from the main heap in his first turn. From that point forward, despite the fact that the heap despite everything contains 1 stone, HL can’t browse this heap since it has been picked by T in the past turn. Thusly, T is the victor.


Leave a Comment

3 × five =