自己太水了—HDOJ_2212
Problem Description
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
Output
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 ;
}
第二次看题居然还是一点思路都没有 说明根本不理解啊。。。
自己太水了—HDOJ_2212的更多相关文章
- hdu 4940 数据太水...
http://acm.hdu.edu.cn/showproblem.php?pid=4940 给出一个有向强连通图,每条边有两个值分别是破坏该边的代价和把该边建成无向边的代价(建立无向边的前提是删除该 ...
- hdoj 4272 LianLianKan 数据太水
LianLianKan Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- Python进阶【第六篇】内置函数中好玩的几个(今天写的太水)
zip()函数 两个参数一一对应,参数是序列类型,序列包括列表,元组,字符串,当两个序列不等长时,按公共最长部分匹配,形似“拉链”. max()和min()函数 以max()为例,min()类似,只是 ...
- POJ 2528(线段树+离散化+特殊离散化)网上博客很少有人真正写对!!! 是POJ数据太水...
Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral electio ...
- CF 332A Down the Hatch! 超级水题。。不过题目太长了
A. Down the Hatch! time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- hdu4950 Monster (水题)
4950 Monster Monster Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- 【codevs 1296】营业额统计 水~~
今天下午先写一个Splay水题来复习一下Splay模板.是不是有点太水了做这种水题我有点良心不安. 可笑的是一开始我竟然WA了一组,看来是我低估水题的数据范围了,我是空节点直接返回inf或-inf,明 ...
- 【BZOJ】2761: [JLOI2011]不重复数字(set+巨水题+超坑题)
http://www.lydsy.com/JudgeOnline/problem.php?id=2761 太水了,不说了. 但是这格式错误我已经没话说了....行末不能有空格 #include < ...
- 【wikioi】1191 数轴染色(线段树+水题)
http://wikioi.com/problem/1191/ 太水的线段树了,敲了10分钟就敲完了,但是听说还有一种并查集的做法?不明觉厉. #include <cstdio> #inc ...
随机推荐
- tomcat+mysql+javaweb+docker
1.安装好docker 2.docker pull tomcat docker pull mysql 3.docker run -it -p 8080:8080 --rm tomcat:7.0 #-i ...
- linux中的条件变量
1 大家可能知道互斥量是线程程序中必须的工具了,但是也不能是万能的,就比如某个线程正在等待共享数据某个条件的发生,这个时候会发生什么呢.它就可能重复的尝试对互斥对象锁定和解锁来检查共享数据结构. 2 ...
- HDU - 1241 POJ - 1562 Oil Deposits DFS FloodFill漫水填充法求连通块问题
Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil de ...
- UnityEngine中Animator相关类的说明
---------------------------------------------------------------------- Animator 这个单独写,比较多 AnimationC ...
- 区间质数查询 luoguP1865
原题 https://www.luogu.org/problemnew/show/P1865 本来get到了一个很好的判断素数的方法 O(玄学常数)https://www.luogu.org/blog ...
- 【微服务】Dubbo初体验
一.前言 之前微服务这块只用过SpringCloud搭建,但是最近面试会被问到dubbo框架,虽然之前也学了但是都忘了,故写此博客加深印象. 二.原理简介 Dubbo是一个分布式服务框架,以及阿里巴巴 ...
- Image.resize()和Image.thumbnail()的区别
Image.resize()和Image.thumbnail()的区别 根据代码和代码注释, 这两个函数都是对图片进行缩放, 两者的主要区别如下: resize()函数会返回一个Image对象, th ...
- Zynq7000开发系列-3(Xilinx交叉编译环境搭建)
一.前言 上一篇文章说了,在开发之前必须先搭建起交叉编译环境,于是这里我们就介绍一下环境的搭建过程. 其实在所安装的Vivado HLx 2016.4中就包含了Xilinx SDK,在该SDK上即可开 ...
- go time笔记
package main import ( "time" "fmt" ) func main() { t := time.Now().UnixNano() fm ...
- Hibernate save()、saveOrUpdate()、merge()的区别
一. update 和 merge的区别 首先在执行更新操作的时候,两者都必须要有id update是直接执行update 语句,执行后状态为持久化状态 而merge则不一样: 1. 如果sessio ...