每日一题洛谷B3841 [GESP202306 二级] 自幂数判断c++
·

#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;
}


更多推荐
所有评论(0)