UVA12895
思路
输入
代码
#include <iostream>
#include <cmath>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long long n,sum=0,q,len=0;
cin>>n;
q=n;
while(q){//判断位数
++len;
q/=10;
}
q=n;
while(q){//加上每位的位数方
sum+=(long long)(pow(q%10,len));
q/=10;
}
cout<<(sum==n?"Armstrong":"Not Armstrong")<<endl;
}
return 0;
十年OI一场空,不开 long long 见祖宗