#include<cstdio> #include<cstring> #include<cmath> using namespace std; int main() { int tc; scanf("%d",&tc); getchar(); while (tc--) { char s[15]; gets(s); int b,l=strlen(s); long long int n,a; n=a=0; for (int i=0;i<l;i++) { b=s[i]-'0'; a+=pow(b,l); n=n*10+b; } if (a==n) printf("Armstrong\n"); else printf("Not Armstrong\n"); } return 0; }
Wednesday, July 20, 2016
UVA 12895 Solution
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment