DFS

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,实际上没有关系,直接暴力解决。



#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std; int main()
{ int a[10],k,sum,s; a[0]=1;
for(int i=1;i<10;i++)
{
a[i]=1;
for(int j=1;j<=i;j++)
{
a[i]*=j;
}
} for(int i=1;i<100000;i++)
{
s=i;
sum=0;
while(s>0)
{
k=s%10;
sum+=a[k];
s/=10;
}
if(sum==i)
printf("%d\n",i);
}
return 0;
}

HDU2212 DFS 2016-07-24 13:52 56人阅读 评论(0) 收藏的更多相关文章

  1. Hadoop1.2.1伪分布模式安装指南 分类: A1_HADOOP 2014-08-17 10:52 1346人阅读 评论(0) 收藏

    一.前置条件 1.操作系统准备 (1)Linux可以用作开发平台及产品平台. (2)win32只可用作开发平台,且需要cygwin的支持. 2.安装jdk 1.6或以上 3.安装ssh,并配置免密码登 ...

  2. Red and Black(BFS or DFS) 分类: dfs bfs 2015-07-05 22:52 2人阅读 评论(0) 收藏

    Description There is a rectangular room, covered with square tiles. Each tile is colored either red ...

  3. HDU1312 Red and Black(DFS) 2016-07-24 13:49 64人阅读 评论(0) 收藏

    Red and Black Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total ...

  4. HDU1045 Fire Net(DFS枚举||二分图匹配) 2016-07-24 13:23 99人阅读 评论(0) 收藏

    Fire Net Problem Description Suppose that we have a square city with straight streets. A map of a ci ...

  5. HDU1181 变形课(DFS) 2016-07-24 13:31 73人阅读 评论(0) 收藏

    变形课 Problem Description 呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒 ...

  6. select document library from certain list 分类: Sharepoint 2015-07-05 07:52 6人阅读 评论(0) 收藏

    S using System; using Microsoft.SharePoint; namespace Test { class ConsoleApp { static void Main(str ...

  7. POJ1087 A Plug for UNIX 2017-02-12 13:38 40人阅读 评论(0) 收藏

    A Plug for UNIX Description You are in charge of setting up the press room for the inaugural meeting ...

  8. 百度地图-省市县联动加载地图 分类: Demo JavaScript 2015-04-26 13:08 530人阅读 评论(0) 收藏

    在平常项目中,我们会遇到这样的业务场景: 客户希望把自己的门店绘制在百度地图上,通过省.市.区的选择,然后加载不同区域下的店铺位置. 先看看效果图吧: 实现思路: 第一步:整理行政区域表: 要实现通过 ...

  9. 棋盘问题 分类: 搜索 POJ 2015-08-09 13:02 4人阅读 评论(0) 收藏

    棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28474 Accepted: 14084 Description 在一 ...

随机推荐

  1. @Transactionl注解

    spring 事务注解 默认遇到throw new RuntimeException("...");会回滚 需要捕获的throw new Exception("...&q ...

  2. dp-最长公共子序列

    最长公共子序列(NYOJ36) 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列.tip:最长公 ...

  3. FP真验货客户的成品和半成品编码部分没有带尾续,导致FP规划错误 IN_SALES_ORDER数据不带CZ

    错误描述:真验货客户的成品和半成品编码部分没有带尾续,导致FP规划错误 IT角度: IN_SALES_ORDER数据不带CZ 现时前台页面数据: 现时后台数据: 一.跟进情况 1.执行SAP_SALE ...

  4. Go语言中cannot convert adminname (type interface {}) to type *: need type assertion的解决办法

    解决的办法是把string(adminname)替换为adminname.(string).其它类型也是类似.

  5. 一个团队和他们的调查表-----("调查表与调查结果分析"心得体会)

    注:这篇blog主要是描述六小灵童团队在从接到调查表任务到分析调查数据最后完成本次任务的过程,以及过程中的点滴和心德体会.---蔡何 1.制表历程 随着课程的推进,我们逐步进入了软件项目中比较重要的需 ...

  6. 97. Interleaving String (String; DP)

    Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = ...

  7. 120. Triangle(Array; DP)

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

  8. iOS8 之后 tableview separatorInset cell分割线左对齐,ios7的方法失效了

    -(void)viewDidLayoutSubviews { if ([self.mytableview respondsToSelector:@selector(setSeparatorInset: ...

  9. TZOJ 4813 机器翻译(模拟数组头和尾)

    描述 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件会先在内存中查找这 ...

  10. 133克隆图 · Clone Graph

    [抄题]: 克隆一张无向图,图中的每个节点包含一个 label 和一个列表 neighbors. [思维问题]: [一句话思路]: 先BFS克隆点(一个点+扩展所有邻居),再克隆邻居(一个点+扩展所有 ...