307684: CF1396B. Stoned Game
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Stoned Game
题意翻译
有n堆石子,每堆分别有$a_i$个石子。 两者轮流取其中一个石子。但不能取上次对手取过的那一堆。特殊的,第一次取可以取任何一堆的石子。 当前先手取完要取的石子之后使对手无路可走时,先手获胜。 t组数据,每组数据给出n和a,输出谁必会胜利。若先手胜利输出“T”,若后者胜利输出“HL”。无引号。 数据范围请参考原题。题目描述
T is playing a game with his friend, HL. There are $ n $ piles of stones, the $ i $ -th pile initially has $ a_i $ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen in the previous turn (the pile that was chosen by the other player, or if the current turn is the first turn then the player can choose any non-empty pile). The player who cannot choose a pile in his turn loses, and the game ends. Assuming both players play optimally, given the starting configuration of $ t $ games, determine the winner of each game.输入输出格式
输入格式
The first line of the input contains a single integer $ t $ $ (1 \le t \le 100) $ — the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $ n $ $ (1 \le n \le 100) $ — the number of piles. The second line contains $ n $ integers $ a_1, a_2, \dots, a_n $ $ (1 \le a_i \le 100) $ .
输出格式
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
输入输出样例
输入样例 #1
2
1
2
2
1 1
输出样例 #1
T
HL