#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
int counter(ll n)
{
int c = 0;
while(n != 0)
{
n = n/10;
c++;
}
return c;
}
int main()
{
ll m , i, n;
while(cin >> m)
{
for(i=1;i<=m;i++)
{
cin >> n;
ll sum = 0, r, j, e = n;
int c = counter(n);
while(n != 0)
{
r = n%10;
n = n/10;
ll d = 1;
for(j=1;j<=c;j++)
{
d *= r;
}
sum += d;
}
if(sum == e)
cout << "Armstrong" << endl;
else
cout << "Not Armstrong" << endl;
}
}
return 0;
}
#define ll unsigned long long int
using namespace std;
int counter(ll n)
{
int c = 0;
while(n != 0)
{
n = n/10;
c++;
}
return c;
}
int main()
{
ll m , i, n;
while(cin >> m)
{
for(i=1;i<=m;i++)
{
cin >> n;
ll sum = 0, r, j, e = n;
int c = counter(n);
while(n != 0)
{
r = n%10;
n = n/10;
ll d = 1;
for(j=1;j<=c;j++)
{
d *= r;
}
sum += d;
}
if(sum == e)
cout << "Armstrong" << endl;
else
cout << "Not Armstrong" << endl;
}
}
return 0;
}
Comments
Post a Comment