Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- bool arm(int n){
- int temp = n, power = 0;
- while(temp){
- power++;
- temp /= 10;
- }
- temp = n; int ans = 0;
- while(temp){
- ans += (pow((temp % 10), power));
- temp /= 10;
- }
- if(ans == n) return true;
- return false;
- }
- int main(){
- int t; cin >> t;
- while(t--){
- int n; cin >> n;
- if(arm(n)) cout << "Yes\n";
- else cout << "No\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement