Problem Description

A DFS(digital factorial sum) number is found by summing the factorial of every digit of a positive integer.

For example ,consider the positive integer 145 = 1!+4!+5!, so it's a DFS number.

Now you should find out all the DFS numbers in the range of int( [1, 2147483647] ).

There is no input for this problem. Output all the DFS numbers in
increasing order. The first 2 lines of the output are shown below.

Input

no input

Output

Output all the DFS number in increasing order.

Sample Output

1
2
...... 题意是 求各位阶乘之和是否等于自己:
//拿到题的时候真的一脸茫然不懂 看这标题dfs 我自己就在哪里想怎么用广搜。。。。还是太蠢
//题目给的数据真是循环超时 啊
//最可笑的不是我不懂超时 而是我不懂。。。0!=??? 等于1啊笨蛋。
//循环上界2147483647是十位数 a[9]是6位数 哪怕10个九也是七位数。。所以上界设为10*a[9]
//写题 好像不百度就不会写哎 蠢哭了 要像比赛一样去做题
#include <stdio.h>
int a[];
int main()
{
int s=;
a[]=;
for(int i=;i<;i++)
{
s*=i;
a[i]=s;
}
int t,sum;
for(int i=;i<=*a[];i++)
{
t=i,sum=;
while(t)
{
sum+=a[t%];
t/=;
}
if(sum==i)
printf("%d\n",i);
}
return ;
}

第二次看题居然还是一点思路都没有 说明根本不理解啊。。。

最新文章

  1. [Java面经] 关于面试的二三事.
  2. Spring,Mybatis 整合Memcache
  3. 理解 OpenStack 高可用(HA) (4): Pacemaker 和 OpenStack Resource Agent (RA)
  4. angularjs之$timeout指令
  5. 二叉树JAVA实现
  6. CentOS 7 service systemnctl
  7. AtomicInteger源码分析——基于CAS的乐观锁实现
  8. POJ 3484
  9. webstore+nodejs
  10. zk mysql 主从自动切换
  11. Python基础入门教程(4)(数据类型)
  12. 算法问题:最长滑道问题(非递归,C++)
  13. SceneKit一个3D场景角色的代码重构
  14. 工控随笔_16_西门子_S7-200.Smart软件安装兼容性说明和错误代码:error code hr=0x80070430
  15. #005Python实验楼基本操作学习笔记
  16. HDU1285确定比赛名次
  17. MyBatis - 7.MyBatis逆向 Generator
  18. pgAdmin4 ubuntu python 安装
  19. springboot使用@ControllerAdvice(二)之深入理解
  20. (转)C# Enum,Int,String的互相转换 枚举转换--非常实用

热门文章

  1. UVa 12333 Revenge of Fibonacci (字典树+大数)
  2. jquery操作select(option)的取值,设置和选中
  3. man帮助的使用
  4. Codevs 1099 字串变换
  5. IT兄弟连 JavaWeb教程 Servlet会话跟踪 Cookie常用方法
  6. Phpstorm建立连接Wampserver的数据库
  7. 阿里云物联网 .NET Core 客户端 | CZGL.AliIoTClient:8. 委托事件
  8. 解决nginx负载均衡高可用keepalived只针对物理机的问题
  9. dom4j的下载 在线文档 创建用户库
  10. wordcloud 的常规方法