You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
510 B

#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
int sum = 0;
int len = 0;
int t;
t = n;
while (t) {
t /= 10;
len++;
}
t = n;
while (t) {
int x = t % 10;
sum += pow(x, len);
t /= 10;
}
if (sum == n)
cout << "T" << endl;
else
cout << "F" << endl;
}
// 自幂数
int main() {
int T;
cin >> T;
while (T--) solve();
return 0;
}