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.

37 lines
637 B

#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 110;
int a[N], al;
int sum;
/*
3
152
111
153
*/
int main() {
int T;
cin >> T;
while (T--) {
al = 0; // 小心
sum = 0;
cin >> n;
int t = n;
while (n) {
a[++al] = n % 10;
n /= 10;
}
// 重新遍历每个数位,每个数位乘以它的len次方,然后加和
for (int i = 1; i <= al; i++) sum += pow(a[i], al);
if (sum == t)
cout << "T" << endl;
else
cout << "F" << endl;
}
return 0;
}