30 lines
495 B
C++
30 lines
495 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
bool check(int x) {
|
|
int len = to_string(x).size();
|
|
|
|
int sum = 0, t = x;
|
|
while (t) {
|
|
int a = t % 10;
|
|
sum += pow(a, len);
|
|
t /= 10;
|
|
}
|
|
|
|
return x == sum;
|
|
}
|
|
|
|
int main() {
|
|
int T;
|
|
cin >> T;//times
|
|
while (T--) {
|
|
int a;
|
|
cin >> a;
|
|
|
|
if (check(a))
|
|
cout << 'T' << endl;
|
|
else
|
|
cout << 'F' << endl;
|
|
}
|
|
return 0;
|
|
} |