#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int num = 0,count=0,sum = 0;
cin >> num;
int x = num;
while(x!=0){
x=x/10;
count++;
}
x= num;
for(int i = 0;i<count;i++){
sum += pow((x%10),count);
x = x/10;
}
if(sum==num){
cout << "这个数字是水仙花数" << endl;
}else{
cout << "这个数字不是水仙花数" << endl;
}
return 0;
}
标签:count,int,水花,num,20000,2.1,include
From: https://www.cnblogs.com/tccjx/p/17652620.html