-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path12895.cpp
58 lines (48 loc) · 864 Bytes
/
12895.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int numDigits(int N)
{
int counter=0;
while(N!=0)
{
N/=10;
counter++;
}
return counter;
}
int main()
{
//freopen("input.txt","r",stdin);
int T;
LL N;
vector<int>digits;
scanf("%d",&T);
while(T--)
{
scanf("%lld",&N);
int n=0;
int original=N;
while(N>0)
{
N/=10;
n++;
}
N=original;
while(N>0)
{
int digit=N%10;
original=original - pow(digit,n);
N/=10;
}
if(original==0)
{
printf("Armstrong\n");
}
else
{
printf("Not Armstrong\n");
}
}
return 0;
}