- chenxueze's blog
自幂数判断.代码
- 2024-11-27 16:44:48 @
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a;
while(a--){
cin>>b;
int c=0,t=b;
while(t!=0){
c++;
t/=10;
}
int cnt=0,y=c;
t=b;
for(int i=0;i<c;i++){
int u=t%10;
cnt+=pow(u,y);
t/=10;
}
if(cnt==b){
cout<<"T"<<endl;
}else{
cout<<"F"<<endl;
}
}
return 0;
}