#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int n, s, t, c, a;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t;
		s = 0;
		c = 0;
		a = t;
		while (t) {
			t /= 10;
			c++;
		}
		t = a;
		while (t) {
			s += pow(t % 10, c);
			t /= 10;
		}
		if (s == a)cout << "T" << endl;
		else cout << "F" << endl;
	}
	return 0;
}

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐