mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
46f6aa3fc4
2200-2299
33 lines
436 B
C++
33 lines
436 B
C++
#include <stdio.h>
|
|
int jieceng(int a)
|
|
{
|
|
int s,i;
|
|
s=1;
|
|
for(i=2;i<=a;i++)
|
|
s*=i;
|
|
return s;
|
|
}
|
|
int weishu(int a)
|
|
{
|
|
int sum=0;
|
|
int b;
|
|
b=a;
|
|
while(a)
|
|
{
|
|
sum+=jieceng(a%10);
|
|
a/=10;
|
|
}
|
|
if(sum==b)
|
|
return 1;
|
|
return 0;
|
|
}
|
|
int main()
|
|
{
|
|
int n,i;
|
|
for(i=1;i<=50000;i++)
|
|
{
|
|
if(weishu(i))
|
|
printf("%d\n",i);
|
|
}
|
|
}
|