#include<iostream>
using std::cout;
using std::endl;
long function(long s);//·µ»ØsµÄË®ÏÉ»¨ºÍ
int main()
{
long i;
const long n=82693916578;
for(i=0;i<=n;i++)
{
if(i==function(i))
cout<<i<<endl;
}
return 0;
}
long function(long s)
{
long sum=0;
int digit=0;
long temp=0;
long temps=s;
//»ñÈ¡sµÄλÊý,±£´æÔÚdigitÖÐ
while(temps)
{
digit++;
temps/=10;
}
//È¡µÃ¸÷λÊý×ÖµÄdigit´Î·½Ö®ºÍ
//ÒÀ´Î´Ó¸öλÊýÇóÆð,±£´æÔÚsumÖУ¬Ã¿´ÎÖ´ÐÐÍâÑ»·ºóÉáÆúsµÄ¸öλÊý×Ö£¬¼´½«s³ýÒÔ10
for(int t=0;t<digit;t++)
{
temp = s%10;//È¡µÃsµÄ¸öλÊý
temps=1;
//ÇóµÃtempµÄdigit´Î·½£¬±£´æÔÚtempsÖÐ
for(int k=0;k<digit;k++)
temps *=temp;
sum+=temps;
s/=10;//ÉáÆúsµÄ¸öλÊý
}
return sum;
}