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. Filter接口编写过滤器

      Filter,过滤器,顾名思义,即是对数据等的过滤,预处理过程.为什么要引入过滤器呢?在平常访问网站的时候,有时候发一些敏感的信息,发出后显示时 就会将敏感信息用*等字符替代,这就是用过滤器对信息 ...

  2. keras、 tensor flow 教程

    [keras]http://keras-cn.readthedocs.io/en/latest/getting_started/concepts/,[tensorflow] http://blog.c ...

  3. Containerpilot 配置文件 之 Telemetry

    如果提供telemetry选项,ContainerPilot将公开可用于刮擦性能telemetry的Prometheus HTTP客户端界面. telemetry接口被公告为consul服务. tel ...

  4. Hibernate查询方式(补)

    -----------------siwuxie095                             Hibernate 查询方式         1.对象导航查询     根据已经加载的对 ...

  5. 最小重组缓冲区和路径MTU发现

    概括: 主要来源于unp,可参考:http://blog.csdn.net/ysu108/article/details/7764461 疑惑: 1. 最小重组缓冲区大小: ipv4为576,ipv6 ...

  6. 创建HTML元素的方法

    第一种:使用 parent.appendchild()方法 HTML页面 <div id="div1"></div> JS文件 //第一步创建标签元素节点 ...

  7. 【D3D】Direct3D中LPRECT(上左右底)和LPoint(x,y)之前转换

    D3DSprite.cpp void CD3DSprite::DrawText(CD3DFont *pFont, char *szString, RECT &DesRect, D3DCOLOR ...

  8. ubuntu自动拉黑破解ssh服务的IP

    2013年的脚本,今天拿出来备份一下. vim /root/secure_ssh.sh #!/bin/bash cat /var/log/auth.log|awk '/Failed/{print $( ...

  9. 如何在win 2008 server和win 7上add web site

    在 windows 2008  server 英文版的操作系统上,通过桌面上的 Computer 右键选择 Manage ,打开 Server Manager,选中左侧资源树中的Roles 在上图右侧 ...

  10. vue路由组件传参

    在组件中使用 $route 会使之与其对应路由形成高度耦合,从而使组件只能在某些特定的 URL 上使用,限制了其灵活性. 使用 props 将组件和路由解耦: 取代与 $route 的耦合 const ...