1 solutions
-
2
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while(n--) { int x; cin>>x; int t=x; //临时储存x int cnt=0; //统计x的位数 while(t) { cnt++; t/=10; } t=x; //临时储存x int sum=0; while(t) { int ge=t%10; sum=sum+pow(ge,cnt); //计算当前位的cnt次方 t/=10; } if(sum==x) //根据题目要求进行判断 { cout<<"T"<<endl; } else { cout<<"F"<<endl; } } return 0; }
- 1
Information
- ID
- 1176
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 159
- Accepted
- 41
- Uploaded By