计算一个三位数是否为“水仙花数”,水仙花数(Narcissistic number)也被称为超完全数字不变数(pluperfect digital invariant, PPDI)、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数(Armstrong number),水仙花数是指一个 3 位数,它的每个数位上的数字的3次幂之和等于它本身。例如:1^3 + 5^3+ 3^3 = 153。是则输出1,否则输出0
#include<stdio.h>
int NarcNum(int i)
{
// 完成水仙花数判断
return ;
}
int main()
{
int a,b;
while(~scanf("%d", &a))
{
printf("%d\n", NarcNum(a));
}
return 0;
}153
1
123 456 153 321 432 370 371 666 777 888 407
0 0 1 0 0 1 1 0 0 0 1