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
526 B
33 lines
526 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
|
||
|
void solve() {
|
||
|
int n;
|
||
|
cin >> n;
|
||
|
int sum = 0;
|
||
|
int len = 0;
|
||
|
int tmp;
|
||
|
tmp = n;
|
||
|
while (tmp) {
|
||
|
tmp /= 10;
|
||
|
len++;
|
||
|
}
|
||
|
|
||
|
tmp = n;
|
||
|
while (tmp) {
|
||
|
int x = tmp % 10;
|
||
|
sum += pow(x, len);
|
||
|
tmp /= 10;
|
||
|
}
|
||
|
if (sum == n)
|
||
|
cout << "T" << endl;
|
||
|
else
|
||
|
cout << "F" << endl;
|
||
|
}
|
||
|
// 自幂数
|
||
|
int main() {
|
||
|
int T;
|
||
|
cin >> T;
|
||
|
while (T--) solve();
|
||
|
return 0;
|
||
|
}
|