#985. 自幂数判断
自幂数判断
说明
自幂数是指,一个 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 位数,满足各位数字 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 次方之和是本身。例如,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>153</mn></mrow></semantics></math>153 是 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3</mn></mrow></semantics></math>3 位数,其每位数的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3</mn></mrow></semantics></math>3 次方之和,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mn>1</mn><mn>3</mn></msup><mo>+</mo><msup><mn>5</mn><mn>3</mn></msup><mo>+</mo><msup><mn>3</mn><mn>3</mn></msup><mo>=</mo><mn>153</mn></mrow></semantics></math>13+53+33=153,因此 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>153</mn></mrow></semantics></math>153 是自幂数;<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1634</mn></mrow></semantics></math>1634 是 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4</mn></mrow></semantics></math>4 位数,其每位数的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4</mn></mrow></semantics></math>4 次方之和,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mn>1</mn><mn>4</mn></msup><mo>+</mo><msup><mn>6</mn><mn>4</mn></msup><mo>+</mo><msup><mn>3</mn><mn>4</mn></msup><mo>+</mo><msup><mn>4</mn><mn>4</mn></msup><mo>=</mo><mn>1634</mn></mrow></semantics></math>14+64+34+44=1634,因此 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1634</mn></mrow></semantics></math>1634 是自幂数。现在,输入若干个正整数,请判断它们是否是自幂数。
输入格式
输入第一行是一个正整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>M,表示有 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>M 个待判断的正整数。约定 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100</mn></mrow></semantics></math>1≤M≤100。
从第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow></semantics></math>2 行开始的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>M 行,每行一个待判断的正整数。约定这些正整数均小于 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><msup><mn>0</mn><mn>8</mn></msup></mrow></semantics></math>108。
输出格式
输出 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>M 行,如果对应的待判断正整数为自幂数,则输出英文大写字母 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">T</mtext></mrow></semantics></math>T,否则输出英文大写字母 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">F</mtext></mrow></semantics></math>F。
提示:不需要等到所有输入结束在依次输出,可以输入一个数就判断一个数并输出,再输入下一个数。
样例
3
152
111
153
F
F
T