自己太水了—HDOJ_2212
2024-08-30 10:00:29
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 ;
}
第二次看题居然还是一点思路都没有 说明根本不理解啊。。。
最新文章
- [Java面经] 关于面试的二三事.
- Spring,Mybatis 整合Memcache
- 理解 OpenStack 高可用(HA) (4): Pacemaker 和 OpenStack Resource Agent (RA)
- angularjs之$timeout指令
- 二叉树JAVA实现
- CentOS 7 service systemnctl
- AtomicInteger源码分析——基于CAS的乐观锁实现
- POJ 3484
- webstore+nodejs
- zk mysql 主从自动切换
- Python基础入门教程(4)(数据类型)
- 算法问题:最长滑道问题(非递归,C++)
- SceneKit一个3D场景角色的代码重构
- 工控随笔_16_西门子_S7-200.Smart软件安装兼容性说明和错误代码:error code hr=0x80070430
- #005Python实验楼基本操作学习笔记
- HDU1285确定比赛名次
- MyBatis - 7.MyBatis逆向 Generator
- pgAdmin4 ubuntu python 安装
- springboot使用@ControllerAdvice(二)之深入理解
- (转)C# Enum,Int,String的互相转换 枚举转换--非常实用
热门文章
- UVa 12333 Revenge of Fibonacci (字典树+大数)
- jquery操作select(option)的取值,设置和选中
- man帮助的使用
- Codevs 1099 字串变换
- IT兄弟连 JavaWeb教程 Servlet会话跟踪 Cookie常用方法
- Phpstorm建立连接Wampserver的数据库
- 阿里云物联网 .NET Core 客户端 | CZGL.AliIoTClient:8. 委托事件
- 解决nginx负载均衡高可用keepalived只针对物理机的问题
- dom4j的下载 在线文档 创建用户库
- wordcloud 的常规方法