/*
第一段程序用来找出 符合的数
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
int fac(int a) {
switch(a) {
case 0: return 0;
case 1: return 1;
case 2: return 2;
case 3: return 6;
case 4: return 24;
case 5: return 120;
case 6: return 720;
case 7: return 5040;
case 8: return 40320;
case 9: return 362800;
}
}
int main() {
char str[30];
int sum = 0;
for(int i = 1; i <= 12147483647; i++)
{
sum = 0;
sprintf(str, "%d", i);
int n = strlen(str);
for(int j = 0; j < n; j++)
sum += fac(str[j] - 48);
if(i == sum)
printf("%d\n", sum);
}
return 0;
}
下面第二段程序采用来输出 避免超时!!~~~
*/
#include <stdio.h>
int main()
{
printf("1\n2\n145\n40585\n");
return 0;
}
这题有一点投机取巧的感觉